Let $X$ be the random variable receiving values in $ \mathbb{N} \cup \{0\}$.
Let $Y_i$ be independent, with equal distribution random variables that receive values in the same group.
Let $ Z = \sum_{i=1}^X Y_i$.
Prove that $\mathbb E[Z] = \mathbb E[X] \mathbb E[Y_1] $
I tried opening the right side, but I've no idea how $Z$ actually works since it always dependent of $X$.
\begin{eqnarray} EZ &=& E[E[Z|X]] \\ &=& \sum_n E[Z| X=n]P[X=n] \\ &=& \sum_n n E[Y_1] P[X=n] \\ &=& \sum_n n P[X=n] (E[Y_1]) \\ &=& E X E Y_1 \end{eqnarray} Addendum:
@Did suggested that I elaborate one of the steps above: $E[\sum_{k=1}^X Y_k| X=n] = E[\sum_{k=1}^n Y_k | X=n] = E[\sum_{k=1}^n Y_k] = \sum_{k=1}^n E Y_k = n E Y_1$. The second equality follows from independence of $Y_k, X$ and the last because the $Y_k$ are identically distributed.