How can I find the characteristic function in this question? This is a question from my university list:

Let $\{x_1, x_2, \ldots, x_n\}$ be statistically independent and identically distributed random variables, each with an exponential probability density function of parameter $1$, that is:
  $$
p_{x_i} (X)=a \cdot e^{-aX} u(X) \quad ,\,i=1,2,\ldots
$$
Let $n$ be a discrete random variable statistically independent of each $x_i$, with a probability density function given by
  $$
p_n (N)=\sum_{k=0}^\infty\frac{e^{-1}}{k!} δ(N-k).
$$
Set the random variable
  $$
y = \sum_{i=1}^n x_i
$$
  where, by definition, $y = 0$ if $n = 0$. Determine:
a) the characteristic function $M_y(v)$;

However, I can't solve this problem problem, I found this solution:
$$M_y = \frac{1}{(a-j \cdot v)^{n}}$$
I don't know how to eliminate the random variable "$n$" from the equation and get a expression that only depends on from v(My(v)). Could someone help me how to complete the solving of this problem???
 A: Use the definition of the characteristic function and separate the instances of expectation values for $n$ and $x_i$ to obtain:
$$M_y(v)=\mathbb{E}[e^{ivy}]=\mathbb{E}[e^{iv\sum_{i=1}^{n}{x_i}}]=\mathbb{E_n[E_{x_i}}[\prod_{i=1}^ne^{iv{x_i}}]]=\mathbb{E}_n[(\mathbb{E_x}[e^{ivx}])^n]$$
However
$$M_x(v)=\mathbb{E}[e^{ivx}]=\int_{0}^{\infty}e^{ivx}ae^{-ax}dx=\frac{a}{a-iv}$$
and now all that's left is to compute the expectation over the state space of the $n$ variable:
$$\begin{align}\mathbb{E}_n[(M_x(v))^n]&=\sum_{N=0}^{\infty}(M_x(v))^N\sum_{k=0}^{\infty}\frac{1}{ek!}\delta(N-k)\\&=\sum_{k=0}^{\infty}\frac{1}{ek!}\sum_{k=0}^{\infty}(M_x(v))^N\delta(N-k)\\
&=\sum_{k=0}^{\infty}\frac{1}{e}\frac{(M_x(v))^k}{k!}\\&=e^{M_x(v)-1}\end{align}$$
and hence we find that
$$M_y(v)=\exp\Big(\frac{iv}{a-iv}\Big)$$
EDIT: Explanation of the first line
Note that the variables $x_1,...,x_n,n$ are independent. This allows us to construct the joint probability distribution
$$f(X_1,..., X_N,N)=p_n(N)\prod_{i=1}^N p_{x_i}(X_i)$$
We can easily see that this is a distribution since trivially
$$\sum_{N=0}^{\infty}\int~\prod_{i=1}^N ~dX_i~f(X_1,..,X_N,N)=1$$
It is indeed a funny looking distribution, because it's state space varies with $N$, and hence that variable has to be chosen first! Nevertheless, with this expression we can compute expectation values like the characteristic function:
$$M_y(v)=\sum_{N=0}^{\infty}p_n(N)\prod_{i=1}^N dX_i \exp(iv\sum_{k=1}^N X_k)f(\{X_i\},N)=\mathbb{E}_N[\mathbb{E}_{\{x_i\}}[e^{iv\sum x_i}]]\\=\sum_{N=0}^{\infty}p_n(N)\Big(\int_{0}^{\infty} dXe^{itX}p_x(X)\Big)^N=\mathbb{E}_N[(M_x(v))^N]$$
The reason why the first line in the equation above is true is essentially because we can pull out $p_n(N)$ because the variables are independent, and view what's left as an expectation value taken over the rest of the variables.
