Show that $E(X|\mathcal{F}_\tau)=\sum\limits_{n\in\mathbb{N}}E(X|\mathcal{F}_n)\mathbf{1}_{\{\tau=n\}}$ 
If $\mathbf{E}X<\infty$ and $\tau$ is a stopping time, then $$\mathbf{E}(X|\mathcal{F}_\tau)=\sum_{n\in\mathbb{N}}\mathbf{E}(X|\mathcal{F}_n)\mathbf{1}_{\{\tau=n\}}.$$

My attempt: First assume that $X$ is nonnegative. The general case will follow directly from nonnegative case.
Let $A\in \mathcal{F}_\tau.$ Then $A\cap \{\tau=n\}\in \mathcal{F}_n$ for every $n\in\mathbb{N}.$ Therefore, \begin{align*}
    \int_{A}\sum_{n\in\mathbb{N}}\mathbf{E}(X|\mathcal{F}_n)\mathbf{1}_{\{\tau=n\}}d\mathbf{P}&=\sum_{n\in\mathbb{N}}\int_{A}\mathbf{E}(X|\mathcal{F}_n)\mathbf{1}_{\{\tau=n\}}d\mathbf{P}=\sum_{n\in\mathbb{N}}\int_{A\cap \{\tau=n\}}\mathbf{E}(X|\mathcal{F}_n)d\mathbf{P}\\&=\sum_{n\in\mathbb{N}}\int_{A\cap \{\tau=n\}}Xd\mathbf{P}=\int_A Xd\mathbf{P}
\end{align*}
where the first equality follows from monotone convergence theorem, third follows from the definition of the conditional expectation.
Question: (1) To prove that $\sum_{n\in\mathbb{N}}\mathbf{E}(X|\mathcal{F}_n)\mathbf{1}_{\{\tau=n\}}$ is indeed the conditional expectation of $X$ wrt $\mathcal{F}_\tau$, I have to prove that it is $\mathcal{F}_\tau$-measurable. How should I do so?
(2) Since the stopping time can take infinite value, my calculation of the integration above holds only when $\tau<\infty$ almost surely. Is the condition $\tau<\infty$ a.s. necessary here?
Thanks in advance!
 A: (1) Recall $\mathscr{F}_\tau$ is, by definition, the set of events satisfying $\mathrm{E} \cap \{\tau = n\} \in \mathscr{F}_n.$ Then, all you need to do is to show that $\underbrace{\left\{ \sum\limits_{n\in \mathbf{N}} \mathbf{E}(X \mid \mathscr{F}_n) \mathbf{1}_{\{\tau=n\}} \in \mathrm{A} \right\}}_{\mathrm{E}} \cap \{\tau = m\} \in \mathscr{F}_m.$ The intersection on the left side becomes $\{\mathbf{E}(X \mid \mathscr{F}_m) \in \mathrm{A}\}\cap\{\tau=m\},$ which clearly belongs to $\mathscr{F}_m.$ Q.E.D.
(2) If $\tau = \infty$ with positive probability, you would need to add it in the sum and make sense of the case $n = \infty$ everywhere.
A: *

*It suffices to prove that for each $n$ and each $\mathcal F_n$-measurable random variable $Y$, the random variable $Y\mathbf 1_{\{\tau=n\}}$ is $\mathcal{F}_{\tau}$-measurable. By an approximation by simple function argument, it suffices to prove it in the most restrictive case where $Y$ is the indicator function of an $\mathcal{F}_{n}$-measurable set, say $B$.  This can be done by checking the definition, by proving that $B\cap \{\tau=n\}\cap \{\tau=k\}$ is an element of $\mathcal F_n$ for all $k$. This intersection is empty for $k\neq n$  and for $k=n$, $\mathcal{F}_{n}$-measurability of $B\cap \{\tau=n\}$ is guaranteed by the fact that $\tau$ is a stopping time. 

*We have to extend the filtration to $t=+\infty$ by taking $\mathcal{F}_{+\infty}$ as the $\sigma$-algebra generated by all the $\mathcal{F}_{t}$, add the term $\mathbb E\left[X\mid \mathcal F_{+\infty}\right]\mathbf 1_{\{\tau=+\infty\}}$ and change the definition of $\mathcal{F}_{\tau}$ as 
$$  
\mathcal{F}_{\tau}=\left\{A\in \mathcal{F}_{+\infty}\mid \forall k, A\cap \{\tau=k\}\in \mathcal F_k\right\}.
$$
