Example 4 Find the solutions to the congruence equation $x^{2} \equiv 1\left(\bmod 2^{l}\right)$.
When $l=1$, the number of solutions is 1,
$$x \equiv 1(\bmod 2)$$

When $l=2$, the number of solutions is 2,
$$x \equiv-1,1\left(\bmod 2^{2}\right)$$

When $l \geqslant 3$, the congruence equation can be written as
$$(x-1)(x+1) \equiv 0\left(\bmod 2^{l}\right)$$

Since $x$ is a solution, it must be expressible as $x=2 y+1$, substituting this into the above equation gives

that is,
$$\begin{array}{l}
4 y(y+1) \equiv 0\left(\bmod 2^{l}\right) \\
y(y+1) \equiv 0\left(\bmod 2^{l-2}\right)
\end{array}$$

Therefore, it must be true that
$$y \equiv 0,-1\left(\bmod 2^{l-2}\right)$$

Thus, the solution $x$ must satisfy
$$x \equiv 1,-1\left(\bmod 2^{l-1}\right)$$

Therefore, the solutions to the original equation are (why)
$$x \equiv 1,1+2^{l-1},-1,-1+2^{l-1}\left(\bmod 2^{l}\right)$$

The number of solutions is 4.