Solution (source code)

= Solution

Use the <natural filtration> $\mathcal F_n=\sigma(X_1,\ldots,X_n)$ of the <simple symmetric random walk>. The event $\{T_1\leq n\}=\bigcup_{k=0}^n\{S_k=1\}$ belongs to $\mathcal F_n$, so $T_1$ is a <stopping time>.

For a positive integer $m$, set $\tau_m=T_1\wedge T_{-m}$. This exit time from the finite interval is integrable: in each block of $m+1$ steps there is a <probability> at least $2^{-(m+1)}$ of all steps being positive, which forces exit if it has not already occurred. Consequently the survival <probabilities> have a geometric upper bound.

We use the bounded-time <optional stopping theorem>: if $M$ is a <martingale> and $\sigma$ a bounded <stopping time>, then $\mathbb E M_\sigma=\mathbb E M_0$. Apply it at $\tau_m\wedge n$ to $S_n$ and to the <square-minus-time martingale of a simple symmetric random walk> $S_n^2-n$. The stopped positions lie in $[-m,1]$, so <dominated convergence> and <monotone convergence> give
$$
\mathbb E S_{\tau_m}=0,\qquad \mathbb E\tau_m=\mathbb E S_{\tau_m}^2.
$$
Writing $p_m=\mathbb P(T_1<T_{-m})$, the first equation becomes $p_m-m(1-p_m)=0$, hence $p_m=m/(m+1)$. The second gives $\mathbb E\tau_m=p_m+m^2(1-p_m)=m$. Since $\tau_m\leq T_1$, its <expectation> satisfies $\mathbb E T_1\geq m$ for every $m$. Therefore
$$
\boxed{\mathbb E T_1=+\infty.}
$$
Nevertheless $\mathbb P(T_1<\infty)\geq p_m\to1$. Thus the <infinite mean first passage of a simple symmetric random walk> occurs despite almost sure finiteness; using unrestricted optional stopping directly at $T_1$ would be unjustified.