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}$. (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.
 A: $\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$.)
A: Your first solution looks reasonable.
I'm not sure I understand what your second solution even really means, with the expected value of the conditional variance and so on. Maybe it works, I'm just not sure how to parse it.
Here is a different idea: write
$$\text{Var}(S_N)=E[S_N^2]-(E[S_N])^2=E[S_N^2]-\mu^2 \lambda^2$$
using part 1. Now
$$E[S_N^2]=\sum_n E[S_N^2 \mid N=n] P[N=n].$$
So now you need to be able to compute $E[S_n^2]$ for each $n$. You have the following:
$$E[S_n^2]=\sum_{i=1}^n E[X_i^2] + \sum_{i=1}^n \sum_{j=i+1}^n 2 E[X_i X_j].$$
This comes about from collecting terms in the 2D array whose sum is $S_n^2$; the idea is very similar to the idea behind the binomial theorem. So the problem reduces to computing $E[X_i^2]$ and $E[X_i X_j]$, along with computing some summations. Can you finish from here?
