$$\text{For odd prime } p,\ \text{exactly } \frac{p-1}{2} \text{ nonzero residues are squares, and } a^{\frac{p-1}{2}} \equiv \pm 1 \pmod{p}$$
Modulo an odd prime, only half the nonzero residues are perfect squares (quadratic residues), and Euler's criterion tells you which by raising to the power $(p-1)/2$.