Let $Y_1, Y_2, \ldots$ be iid. random variables in $\mathcal{L}^1$, $\mu:=\mathbb{E} Y_i$, and $\tau \geq 1$ a stopping time (w.r.t. the natural filtration), $\mathbb{E} \tau<\infty$. Let $S_n=\sum_{i=1}^n Y_i$. Show that $\mathbb{E} S_\tau=\mu \cdot \mathbb{E} \tau$. Hint: use a martingale.
I was wondering if instead of using a martingale I could just take the expectation of
$$\sum_{k=1}^{\infty}Y_n \cdot \mathbf{1}\{T > n\} = \sum_{k=1}^{T}Y_n$$ which would equal $$\mathbb{E}\left(\sum_{k=1}^{\infty}Y_n \cdot \mathbf{1}\{T > n\} \right)= \sum_{k=1}^{\infty}\mathbb{E} \left(Y_n \right)\mathbb{P}\left(T>n \right) = \mu \mathbb{E}(T)$$