Statement

If $(X_n)$ is a martingale and $T$ is a stopping time such that

$$ T\le m \quad \text{a.s.} $$

for some constant $m$, then

$$ \mathbb E[X_T]=\mathbb E[X_0]. $$

Key proof identity

Write

$$ X_T-X_0

\sum_{k=1}^{m}(X_k-X_{k-1})\mathbf 1(k\le T). $$

Taking expectations term by term works because

$$ \{k\le T\}=\{T\ge k\}\in \mathcal F_{k-1}, $$

so $\mathbf 1(k\le T)$ is known at time $k-1$ and can be pulled out of the conditional expectation.

Martingale step

For each $k$,

$$ \mathbb E[X_k-X_{k-1}\mid \mathcal F_{k-1}]=0. $$

Hence every summand has expectation $0$, and therefore

$$ \mathbb E[X_T]=\mathbb E[X_0]. $$