I'm currently studying for an exam on probability theory and encountered a problem on which I got quite stuck. It goes as follows:
Let $(X_n)_{n \in \mathbb{N}}$ be an independent family of random variables on a probability space $(\Omega, \mathcal{F}, \mathbb{P}$). Let $N$ be an $\mathbb{N}$-valued random variable that is independent of the family $(X_n)_n$. Write $X := X_N$. Then the characteristic function $\phi^X$ of $X$ is given by $$\phi^X(t) = \sum_{n=1}^{\infty}\mathbb{P}(N=n)\phi^{X_n}(t).$$
Any help is greatly appreciated.
EDIT: Here's what I have so far.
Writing out the RHS we have $$\sum_{n=1}^{\infty}\mathbb{P}(N=n)\phi^{X_n}(t) = \sum_{n=1}^{\infty}\mathbb{P}(N=n)\mathbb{E}[e^{itX_n}] = \sum_{n=1}^{\infty}\mathbb{E}[\mathbb{1}_{\{N=n\}}]\mathbb{E}[e^{itX_n}].$$ Since $N$ is independent of $(X_n)_n$, it is also independent of $(e^{itX_n})_n$, hence $\mathbb{1}_{\{N=n\}}$ and $(e^{itX_n})_n$ are independent. Thus we get $$\sum_{n=1}^{\infty}\mathbb{E}[\mathbb{1}_{\{N=n\}}]\mathbb{E}[e^{itX_n}] = \sum_{n=1}^{\infty}\mathbb{E}[\mathbb{1}_{\{N=n\}}e^{itX_n}],$$ but from here I don't know how to proceed.
You're pretty much there. The trick is to note
$$\sum_{n=1}^{\infty} \mathbb{1}_{\{N=n\}}e^{itX_n} = e^{itX}.$$
To see this, note that if you have $\omega \in \Omega$, then $\sum_{n=1}^{\infty} \mathbb{1}_{\{N=n\}}(\omega)e^{itX_n(\omega)} = e^{itX_{N(\omega)}(\omega)} = e^{itX(\omega)}$.
Combining with the work you already did,
$$ \begin{aligned} \phi_X(t) :&= \mathbb{E}[e^{itX}] \\ &= \mathbb{E}\left[ \sum_{n=1}^{\infty} \mathbb{1}_{\{N=n\}}e^{itX_n} \right] \\ &=\sum_{n=1}^{\infty} \mathbb{E}[\mathbb{1}_{\{N=n\}}e^{itX_n}] \\ &= \sum_{n=1}^{\infty}\mathbb{P}(N=n)\phi^{X_n}(t). \end{aligned} $$
$\blacksquare$