That's the squaring step in the standard method of modular exponentiation by repeated squaring
$$\!\!\!\!\!\begin{align} a^{\large n}\ {\rm mod}\ m &\,=\, b\\ \Rightarrow\ \ \ a^{\large 2n}\ {\rm mod}\ m &\,=\, b^{\large 2}\ {\rm mod}\ m\end{align}\qquad $$
The proof is easy by converting to congruences - which are more convenient arithmetically
$$\begin{array}{rrl} &a^{\large n}\ {\rm mod}\ m &\!\!=\ b\\
\Rightarrow&\ \ a^{\large n}\! &\!\!\equiv\ b\ \ \pmod m\\
\color{#c00}\Rightarrow&\ \ a^{\large 2n}\! &\!\!\equiv\ b^{\large 2} \pmod m\\
\Rightarrow&\ a^{\large 2n}\ {\rm mod}\ m &\!\!\!=\ b^{\large 2}\ \ {\rm mod}\ m\end{array}\qquad$$
where the $\rm\color{#c00}{red}$ inference employs the $ $ Congruence Power Rule for power $\,k = 2\,$ (squaring)
$$\qquad\qquad\ \ \begin{align} c &\,\equiv \, d\pmod m\\ \Rightarrow\ \ \ c^{\large k}\! &\,\equiv\, d^{\large k}\!\!\!\!\pmod m\end{align}\qquad $$
which is an inductive extension of the Congruence Product Rule $ $ (which could instead be used)
$$\qquad\qquad\ \ \begin{align} c &\,\equiv \, d\pmod m\\ \bar c &\,\equiv \, \bar d\!\pmod m\\ \Rightarrow\ \ \ c\bar c\! &\,\equiv\, d\bar d\!\!\!\!\pmod m\end{align}\qquad $$
The other inferences are standard conversions between mod as an operator and congruence, and their proofs are straightforward using the definitions.
Remark $\ $ Generally, as above, it is straightforward to prove properties of the mod operator by first converting to congruence form, then applying the arithmetical laws of congruences then, finally, converting back to operator form. While it is possible to perform such proofs without congruences, generally that will be messier, and less conceptual.