Expanding $(2^b-1)\cdot(1+2^b+2^{2b}+ \cdots + 2^{(a-1)b})$ Can someone please explain to me how the following works (primarily interested in an explanation of the second step when $2^b$ is expanded?
I understand how each series cancels out to equal $2^n-1$ at the end.
$$\begin{align*}
xy&=(2^b-1) \cdot (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b})\\
&=2^b \cdot (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b}) - (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b})\\
&=(2^b + 2^{2b} + 2^{3b} + \cdots + 2^{ab})-(1+2^b+2^{2b}+ \cdots + 2^{(a-1)b})\\
&=2^{ab}-1\\
&=2^n-1
\end{align*}$$

You can perhaps understand this better if you set $t=2^b$, so your product becomes
$$
(t-1)(1+t+t^2+\dots+t^{a-1})
$$
Distribute:
$$
t(1+t+t^2+\dots+t^{a-1})-(1+t+t^2+\dots+t^{a-1})
$$
Push $t$ in the first term inside the parenthesis:
$$
(t+t^2+t^3+\dots+t^{a})-(1+t+t^2+\dots+t^{a-1})
$$
Regroup:
$$
\underbrace{(t+t^2+t^3+\dots+t^{a-1})+t^{a}}_{t+t^2+t^3+\dots+t^{a}}
\;
\underbrace{{}-1-(t+t^2+\dots+t^{a-1})}_{-(1+t+t^2+\dots+t^{a-1})}
$$
Cancel the opposite terms:
$$
t^a-1
$$
Substitute back $t=2^b$:
$$
(2^b)^a-1=2^{ab}-1
$$
Conclusion:
$$
(2^b-1)(1+2^b+2^{2b}+ \cdots + 2^{(a-1)b})=2^{ab}-1
$$
