To derive the mgf of the negative binomial distribution we are going to use the following identity:
$$\binom{-r}{y}=\left( -1 \right)^y \binom{r+y-1}{y} $$
We can prove that in the following way:
$$\begin{align}
\binom{-r}{y} & = \frac{ \left( -r \right) \left(-r-1 \right) \ldots \left(-r-y+1 \right)}{y!}\\
& = \left(-1 \right)^y \frac{ \left(r+y-1 \right) \ldots \left( r+1 \right)r}{y!} \\
& = \left(-1 \right)^y \binom{r+y-1}{y}
\end{align}$$
Now
$$M \left( t \right)=\sum_{y=0}^{\infty} e^{ty} \binom{y+r-1}{r-1} \left( 1-p \right)^y \times p^r $$
Grouping terms and using the above idenity we get:
$$\begin{align} M \left( t \right)& =p^r \sum_{y=0}^{\infty} \binom{y+r-1}{r-1} \left[ e^t \left( 1-p \right) \right]^y \\&=p^r\sum_{y=0}^{\infty} \binom{-r}{y}\left( -1 \right)^y\left[ e^t \left( 1-p \right) \right]^y \\& =p^r\sum_{y=0}^{\infty} \binom{-r}{y}\left[ -e^t \left( 1-p \right) \right]^y \end{align} $$
Then using Newton's Binomial Theorem: $\left( x+1 \right)^r= \sum_{i=0}^\infty {r\choose i}x^i$ provided that $|x|<1$, the last term becomes:
$$M \left(t \right)= \frac{p^r}{\left[ 1- \left(1-p \right)e^t \right]^r}$$
provided that $t<-\log(1-p)$
Note that the negative binomial distribution can come with a slightly different parameterization as well, as it has been pointed out in the comments. I leave it to you to derive the mgf for the other case.
Hope this helps.
Best Answer
It appears that $x$ is the number of failures before the $k$-th success. Thus, there are $x$ failures and $k-1$ successes before the $k$-th success, for a total of $x+k-1$ trials. There are $\binom{x+k-1}{k-1}$ ways to choose where in the string of $x+k-1$ outcomes the $k-1$ successes fall. The probability of any particular one of these strings is the product of the probabilities of the individual outcomes; $x$ of those outcomes are failures and have probability $1-p$, and $k-1$ are successes and have probability $p$, so the probability of any one of these $\binom{x+k-1}{k-1}$ possible sequences of outcomes is $p^{k-1}(1-p)^x$. The total probability of a string of $x$ failures and $k-1$ successes is therefore
$$\binom{x+k-1}{k-1}p^{k-1}(1-p)^x\;.$$
The probability that any of these sequences is followed by a success (namely, the $k$-th success) is $p$, so the probability that the $k$-th success is preceded by $x$ failures is
$$p(x)=\binom{x+k-1}{k-1}p^k(1-p)^x\;.$$