Suppose $X$ has a $Binomial(n,p)$ distribution. Then its moment generating function is
$$ M(t) = \sum_{x=0}^x {n \choose x}p^x(1-p)^{n-x} \\ =\sum_{x=0}^{n} {n \choose x}(pe^t)^x(1-p)^{n-x}\\ =(pe^t+1-p)^n $$
Can someone please explain how the sum is obtained from lines (2) to (3)?