I am trying to understand the solution of a problem.
$X_1,X_2,....$ a sequence of independents randoms variables and same probability distribution.
$N$ rv. taking its values in $\mathbf{N}$
Considering $Z=\sum_{i=i}^N X_i$
We have : $G_Z(s)=E(s^Z)=E(s^{\sum_{i=0}^N X_i})=\sum_kE(s^{\sum_{i=0}^N X_i}|N=k)P(N=k) $
I don't understand how can we pass from $E(s^{\sum_{i=0}^N X_i})$ to that $\sum_kE(s^{\sum_{i=0}^N X_i}|N=k)P(N=k)$