# Using the law of total expectation and the definition of the MGF to find the unconditional distribution

During my research, I encountered Jarle Tufto's answer in this question on the MGF of conditioned random variables:

The mgf of $$Y$$ conditional on $$N=n$$ is $$M_{Y|N=n}(t)=M_X(t)^n,$$

since $$Y$$ is a sum of independent random variables each with mgf $$M_X(t)$$. Using the law of total expectation and the definition of the mgf, the mgf of the unconditional distribution of $$Y$$ is

$$M_Y(t) = E e^{tY} = E E(e^{tY}|N)=E M_X(t)^N$$

I am currently working on the following problem from my textbook Introduction to Probability by Blitzstein and Hwang:

Judit plays in a total of $$N \sim \text{Geom}(s)$$ chess tournaments in her career. Suppose that in each tournament she has probability p of winning the tournament, independently. Let T be the number of tournaments she wins in her career.

I am trying to find find the MGF of $$T$$.

The solution proceeds as follows:

$$E(e^{tT} ) = E(E(e^{tT} | N)) = E((pe^t + q)^N)$$

$$\vdots$$

The problem is that I cannot find any resource that explains how one gets from $$E(E(e^{tT} | N))$$ to $$E((pe^t + q)^N)$$ - that is, how one derives that $$E(e^{tT} | N) = (pe^t + q)^N$$. I am trying to derive this, but it isn't clear to me how to go from the former expression to the latter.

Jarle Tufto's answer was the closest I could find for this, but he also does not explain any details for how he derived it, and simply states it as fact - just as all of the other resources I've come across.

I would greatly appreciate it if people could please take the time to explain how this is done.

To be specific, that is MGF of binomial distribution. Let $$X\sim B(n,p)$$ be a binomial RV, which can be considered as sum of independent Bernoulli trials, $$X=X_1+...X_n$$, all iid with $$\text{Ber}(p)$$: $$E[e^{tX}]=E[e^{t(X_1+...+X_n)}]=E\left[\prod_{i=1}^n e^{tX_i}\right]=\prod_{i=1}^n E[e^{tX_i}]=E[e^{tX_1}]^n$$ Bernoulli MGF is easy: $$M_{X_1}(t)=E[e^{tX_1}]=P(X_1=0)+P(X_1=1)e^{t}=1-p+pe^t$$ When substituted, it gives what you're asking.