Example 9 Find the remainder when the square of a prime number greater than 5 is divided by 30.
Solution: Let $p$ be a prime number greater than 5, and $p=r(\bmod 30)$
$$
\begin{array}{l}
(r<30), \\
\because(p, 30)=1, \therefore(r, 30)=1, r=1,7,11, \\
13,17,19,23,29, \\
\because 1^{2} \equiv 11^{2} \equiv 19^{2} \equiv 29^{2} \equiv 1(\bmod 30), \\
7^{2} \equiv 13^{2} \equiv 17^{2} \equiv 23^{2} \equiv 19(\bmod 30), \\
\therefore p^{2} \equiv 1 \text { or } 19(\bmod 30) .
\end{array}
$$