Consider the following problem, from the book Probability by Grimmett and Welsh:
Let $X_1,X_2,\dots$ be discrete random variables, each having mean $\mu$, and let $N$ be a random variable which takes values in the non-negative integers and which is independent of the $X_i$. By conditioning on the value of $N$, show that $$ \mathbb{E}(X_1+X_2+\dots+X_N)=\mu\mathbb{E}(N). $$
Since taking the expected value is a linear operation, and the $X_i$ all have expected value $\mu$, we have that $$ \mathbb{E}(X_1+\dots+X_N|N=n) = n\mathbb{E}(X_i|N=n) = n\mu. $$ This is, I believe, what the book means by "conditioning on the value of $N$", but I really do not understand how to apply conditional expectation here.
Use the law of total expectation, namely, $$ E(X_{1}+\dotsb+X_{N})=E(X_{1}+X_{2}+\dotsb+X_{N}\mid N) =E(N\mu)=\mu E(N) $$ since $$ E(X_{1}+X_{2}+\dotsb+X_{N}\mid N=n)=\sum_{i=1}^nE(X_i)=n\mu. $$