Let $N \sim \mathrm{Poisson}(c)$ with $c > 0$. Let $(S_n)_{n=0}^\infty$ be a random walk independent from $N$. In a proof I'm reading, it is claimed that
$$E\left[\exp(i\langle z, S_N\rangle)\right] = \sum_{n=0}^\infty P(N=n) E\left[\exp(i\langle z, S_n \rangle)\right].$$
I can't see why this holds. I tried writing $S_N = \sum_{n=0}^\infty S_{n} I_{\{N=n\}}$ and this gives a good intuition for why the formula should be true, but I can't justify why the formula holds.
Any help will be greatly appreciated!
We can write $$ \exp (i \langle z, S_N \rangle) = \sum_{n=0}^\infty \exp(i \langle z, S_n \rangle) I_{\{N=n\}}. $$
Now take expectations and use independence. (Be careful to justify taking limits out of the expectation operator.)