Hint: This follows from the formula
$$ 1 + x + \dots + x^{n-1} = \frac{x^n - 1}{x - 1} $$
which holds for any positive integer $n$ and $x \
eq 1$.
You can prove this formula by doing the multiplication
\begin{align*} (1 + x + \dots + x^{n-1} )(x - 1) &= x^n + (x^{n-1} - x^{n-1}) + (x^{n-2} - x^{n-2}) + \dots + (x - x) - 1 \\\ & = x^n - 1. \end{align*}