HINT : The random walk process $S$ is defined as follows : $$S_n=S_{n-1}+U_{n}$$ with $S_0=0$ and $U_n$'s IDD , $P(U_k=1)=P(U_k=-1)=0.5$.
We denote $\mathcal{F}$ the natural filtration of $S$.
Let $n>0$, you can note that because $U_n$ is independent of $\mathcal F_{n-1}$, $S_{n-1}$ is $\mathcal F_{n-1}$-measurable, and $E(U_n)=0$, $S_n$ is a martingale :
$$E(S_n|\mathcal F_{n-1})=S_{n-1}+E(U_n|\mathcal F_{n-1})=S_{n-1}+E(U_n)=S_{n-1}$$
Moreover ,
$$E((S_n-S_{n-1})^2|\mathcal F_{n-1})=E(U_n^2|\mathcal F_{n-1})=E(U_n^2)=1$$
$$E((S_n-S_{n-1})^2|\mathcal F_{n-1})=E(S_n^2|\mathcal F_{n-1})-2S_{n-1}E(S_n|\mathcal F_{n-1})+S_{n-1}^2$$
Thus,
$$E(S_n^2|\mathcal F_{n-1})-1=S_{n-1}^2$$
or
$$E(S_n^2-n|\mathcal F_{n-1})=S_{n-1}^2-(n-1)$$
Therefore, $M_n$ defined below is a martingale $$M_n=S_n^2-n$$
Given that $M$ is a martingale, and $T$ is a bounded stopping time , we have $$E(M_T)=M_0=0$$
or
$$E(S_T^2)=E(T)$$