Confusions regarding the concept of a stopping time for a martingale I am studying martingales and I have a few conceptual questions regarding why we need stopping times. My book (Probability and Computing by Mitzenmacher and Upfal) defines a martingale as follows:
A sequence of random variables $Z_0,Z_1,\ldots$  is a martingale with respect to the sequence $X_0,X_1,\ldots$ if $\forall n\geq 0$, the following condition holds:


*

*$Z_n$ is a function of $X_0,X_1,\ldots, X_n$ 

*$\mathbb{E}(|Z_n|) < \infty$

*$\mathbb{E}(Z_{n+1}\mid X_0,\ldots, X_n) = Z_n$


Here is what I don't get: It seems to me, you could just pick any random variable and symbolically assert the following:
$\forall n \geq 0, \mathbb{E}(Z_n)=\mathbb{E}(Z_0) $ using the tower of expectations property recursively, so how do I symbolically verify the need to worry about the stopping time and develop the martingale stopping theorem?
PS: Is the following guess as to why we need the stopping theorem correct? We need it because the original theorem might be defined for a countably infinite number of random variables and stopping it at a random time might break the conditions under which it holds? 
 A: When $T$ is not a stopping time, $\mathrm E(Z_T)$ can be well defined but very different from $\mathrm E(Z_0)$. Consider for instance the symmetric random walk $(Z_n)_{n\geqslant0}$ on the integer line which starts from $Z_0=0$ and whose steps are $\pm1$. Let $R$ denote the time of the first return to $0$, and $T$ the last time before $R$ such that $Z$ is maximal on the time span $[0,R]$, that is, such that $Z_T\geqslant Z_n$ for every $0\leqslant n\leqslant R$. 
Then $Z_R=0$ almost surely hence $\mathrm E(Z_R)=0$. On the other hand, $Z_T\geqslant0$ almost surely and $Z_T\geqslant1$ with positive probability hence $\mathrm E(Z_T)\gt0$. One sees that $\mathrm E(Z_R)=\mathrm E(Z_0)$ and $\mathrm E(Z_T)\ne\mathrm E(Z_0)$. Of course, $R$ is a stopping time while $T$ is not.
Edit In the case described above, one can even show that $Z_T$ is not integrable. To see this, note that $Z_T=0$ on $[Z_{-1}=-1]$, which happens with probability $\frac12$, and that, for each integer $z\geqslant1$, $Z_T\geqslant z$ if and only if $Z_1=1$ and, starting from $1$, one hits the level $z$ before the level $0$. This last event has probability $\frac1z$ hence, for every $z\geqslant1$, $\mathrm P(Z_T\geqslant z)=\frac1{2z}$. In particular $\mathrm E(Z_T^-)=0$ and $\mathrm E(Z_T^+)=+\infty$ hence $\mathrm E(Z_T)=+\infty$.
