Clarification of algebra in moment generating functions
They are applying the formula for a finite geometric series,
$$ \sum_{k=0}^n x^k = \frac{x^{n+1}-1}{x-1}.$$
This formula can be derived in various ways, including some which involve polynomial division.
Here is one approach :
Let,
$$ S_n(x) = \sum_{k=0}^n x^k ,$$
and note that,
$$ x S_n(x) = \sum_{k=0}^n x^{k+1} ,$$
$$ x S_n(x) = \sum_{k=1}^{n+1} x^{k} ,$$
$$ x S_n(x) = \sum_{k=1}^{n} x^{k} + x^{n+1} ,$$
$$ 1+ x S_n(x) = 1+\sum_{k=1}^{n} x^{k} + x^{n+1} ,$$
$$ 1+ x S_n(x) = \sum_{k=0}^{n} x^{k} + x^{n+1} ,$$
$$ 1+ x S_n(x) = S_n(x) + x^{n+1} ,$$
$$ x S_n(x) = S_n(x) + x^{n+1}-1 ,$$
$$ x S_n(x) - S_n(x) = x^{n+1}-1 ,$$
$$ (x-1) S_n(x) = x^{n+1}-1 ,$$
$$ S_n(x) = \frac{x^{n+1}-1}{x-1} ,$$
It's a geometric series: $1 + (e^t) + (e^t)^2+...+(e^t)^{n-1}$ with the sum given as a part of your expression.