Let $(X_i)_{i \geq 1}$ and $\tau \geq 1$ be independent random variables with $\mathbb{E}[X_i]=\mu$ for all $i \geq 1$. Moreover, let $S_k:= \sum_{i=1}^k X_i$.
I want to show that $$\mathbb{E}[S_{\tau}\mid \tau]=\mu \tau.$$
In my solution, it is written that
$$\mathbb{E}[S_{\tau}\mid \tau]=\mathbb{E}[S_k]\mid_{k=\tau} = \mu k \mid_{k=\tau}=\mu \tau.$$
Now I wonder whether the first step is valid for all kind of random variables? Somewhere we probably use independence of the $X_i$ and $\tau$, but I am not sure where. Additionally, we also need that $S_{\tau}$ is integrable - where do we need this? Would be very nice if you could help me with this.
By independence $\mathbb{E}(X_i | \tau) = \mathbb{E}(X_i) = \mu$, the rest is just linearity of expectation. Also, if we're being picky we should say $\mathbb{E}(S_\tau | \tau) = \mu \tau$ almost surely, since conditional expectation is only considered unique up to a set of measure zero.