Example 3 A troubled student walks through a hall, in which there is a row of closed lockers, numbered from 1 to 1024. After opening locker number 1, he continues forward, alternately not touching or opening each closed locker. When he reaches the end of the hall, he turns around and heads back, opening the first closed locker he encounters. The student continues to walk back and forth in this manner until all lockers are open. What is the number of the last locker he opens?
Assume there are $2^{k}$ closed lockers in a row, and the number of the last locker opened by the student is $L_{k}$. When the student first reaches the end of the hall, $2^{k-1}$ closed lockers remain, all of which have even numbers. These closed lockers are arranged in decreasing order from the student's position to the other end. Now, renumber these lockers from 1 to $2^{k-1}$. Note that the locker originally numbered $n$ (where $n$ is even) becomes the locker numbered $2^{k-1}+1-\frac{n}{2}$. According to the new numbering, the number of the last locker opened by the student should be $L_{k-1}$, and the original number is $L_{k}$. Therefore,
$$
L_{k-1}=2^{k-1}+1-\frac{L_{k}}{2} \text{. }
$$

That is, $L_{k}=2^{k}+2-2 L_{k-1}$.
Thus, $L_{k}=2^{k}+2-2\left(2^{k-1}+2-2 L_{k-2}\right)=4 L_{k-2}-2$
$$
L_{k}-\frac{2}{3}=4\left(L_{k-2}-\frac{2}{3}\right)
$$
(here $\frac{2}{3}$ is the root of the equation $x=4 x-2$). Since $L_{0}=1, L_{1}=2$, when $k$ is even,
$$
L_{k}-\frac{2}{3}=\left(L_{0}-\frac{2}{3}\right) \cdot 4^{\frac{k}{2}}, L_{k}=\frac{1}{3}\left(4^{\frac{k}{2}}+2\right) .
$$

When $k$ is odd,
$$
L_{k}-\frac{2}{3}=\left(L_{1}-\frac{2}{3}\right) \cdot 4^{\frac{k-1}{2}}, L_{k}=\frac{1}{3}\left(4^{\frac{k+1}{2}}+2\right) .
$$

Therefore, for all positive integers $k$, $L_{k}=\frac{1}{3}\left(4^{\left[\frac{k+1}{2}\right]}+2\right)$.
In particular, $1024=2^{10}, k=10, L_{10}=\frac{1}{3}\left(4^{5}+2\right)=342$, i.e., the number of the last locker opened is 342.