Let $S_n = \sum_{i=1}^nX_i$ (where the $X_i$ are i.i.d.) and let N be a positive, integer valued r.v., independent from the sequence $X_n$. Suppose also that $E[N]<\infty$ and $E[|X_i|]<\infty$.
What I want to prove is the following step: $$E\biggr[\sum_{n=0}^\infty S_n\mathbf1_{(N=n)}\biggl] =\sum_{n=0}^\infty E[S_n\mathbf1_{(N=n)}]$$ The explanation should be the Fubini theorem, but for applied it, I should demonstrate that $$\sum_{n=0}^\infty E[|S_n\mathbf1_{(N=n)}|]<\infty $$ This is what I have to prove right?
using independence and the fact that the $X_i$ are independent I come up with: $\sum_{n=0}^\infty\mu nP(N=n)$ where $\mu=E(X_i)$ that we know to be $<\infty$. But here I don't know how to proceed
I assume that all $X_i$'s are independent and have identic distribution.
In order to apply Fubini, you have to show (like you said)
$$\sum_n E(|S_n|I_{\{N=n\}}) <\infty$$
We now prove this:
$$\sum_n E(|S_n|I_{\{N=n\}}) = \sum_n E\left(\left|\sum_{k=1}^n X_k\right|I_{\{N=n\}}\right) \leq \sum_n E\left(\sum_{k=1}^n |X_k|I_{\{N=n\}}\right)$$
$$= \sum_n \sum_{k=1}^n E(|X_k|)P(N=n) = \sum_n n E(|X_1|)P(N=n) $$
$$= E(|X_1|) \sum_n nP(N=n) = E(|X_1|) E(N) < \infty$$
You can also apply dominated convergence theorem:
$$E\left[\sum_{n=0}^\infty S_nI_{\{N=n\}}\right]= E\left[\lim_{k \to \infty}\sum_{n=0}^k S_nI_{\{N=n\}}\right] = \lim_{k \to \infty} E\left[\sum_{n=0}^k S_nI_{\{N=n\}}\right]$$$$= \sum_{n=0}^\infty E[S_n]P(N=n) = E[X_1]E[N]$$
here the sequence of functions $(\sum_{n=0}^k S_n I_{\{N=n\}})_{k=1}^\infty$ is dominated by the integrable function $\sum_{n=0}^\infty |S_n| I_{\{N=n\}}$ as the calculation above shows.