TITLE: Suppose $\xi_1, \xi_2,\ldots$ are i.i.d. random variables with mean $\mu$, variance $\sigma^2$. Form the random sum $S_{N} = \xi_{1}+\cdots+\xi_{N}$.
QUESTION [6 upvotes]: (a) Derive the mean and variance of $S_{N}$ when $N$ has Poisson distribution with parameter $\lambda$.
So far, for the mean, I have the following:
$E[S_{N}] = E[E[S_{N}\mid N=n]]$ 
$$ = \sum_{n=1}^{\infty} E[\xi_{1}+\cdots+\xi_{N}\mid N=n] p_{N}(n)$$
$$ = \sum_{n=1}^{\infty} E[\xi_{1}+\cdots+\xi_{n}\mid N=n] p_{N}(n)$$ 
$$ = \sum_{n=1}^{\infty} E[\xi_{1}+\cdots+\xi_{n}] p_{N}(n)$$
$$ = \sum_{n=1}^{\infty} (E[\xi_{1}]+\cdots+E[\xi_{n}]) p_{N}(n)$$
$$ = \sum_{n=1}^{\infty} n\mu p_{N}(n)$$
$$ = \mu \sum_{n=1}^{\infty} n p_{N}(n)$$
$ = \mu \lambda$.
Are my steps legal?
Also, for the variance I have the following:
$\operatorname{var}(S_{N}) = \operatorname{var}(E[S_{N}\mid N=n]) + E[\operatorname{var}(S_{N}\mid N=n)]$
$$ = \operatorname{var}(E[\xi_{1}+\cdots+\xi_{n}\mid N=n]) + E[\operatorname{var}(\xi_{1}+\cdots+\xi_{n}\mid N=n)]$$
$$ = ? + \sum_{n=1}^{\infty} \operatorname{var}(\xi_{1}+\cdots+\xi_{n}) p_{N}(n)$$
$$ = ? + \sum_{n=1}^{\infty} \operatorname{var}(\xi_{1}+\cdots+\xi_{n}) p_{N}(n)$$
$$ = ? + \sigma^2 \sum_{n=1}^{\infty} n p_{N}(n)$$
$ = ? + \sigma^2 \lambda$.
Obviously, I am stuck and do not know how to handle the left side of the sum. Can somebody please explain in detail the next steps. Thank you.

REPLY [3 votes]: $\newcommand{\var}{\operatorname{var}}\newcommand{\E}{\operatorname{E}}$The distribution of $S_N$ is called a "compound Poisson distribution".
$$
\var(S_N \mid N=n) = \var(S_n) = n\sigma^2.
$$
Therefore
$$
\var(S_N\mid N) = N\sigma^2,
$$
so
$$
\E(\var(S_N\mid N)) = \sigma^2\E(N) = \sigma^2\lambda.
$$
Next we have
$$
\E(S_N\mid N=n) = \E(S_n) = n\mu.
$$
Therefore
$$
\E(S_N\mid N)) = N\mu,
$$
and so
$$
\var(\E(S_N\mid N)) = \var(N\mu) = \mu^2 \var(N) = \mu^2\lambda.
$$
Consequently
$$
\var(S_N) = \lambda(\mu^2+\sigma^2).
$$
Note that this is $\lambda\E(S_1^2)$ and see also this item on cumulants of compound Poisson distributions.  In the case in which $\lambda=1$, one finds that the cumulants (including the variance) of a compound Poisson random variable $S_N$ are just the raw moments of $S_1$. (For degree $k\ge4$ (and also for $k=1$), the $k$th cumulant is not just the $k$th central moment, but the variance is both the central moment and the cumulant of degree $2$.)