\documentclass[a4paper,12pt]{article}
\begin{document}
\parindent=0pt
QUESTION
Explain why $\sum_{a=0}^{p-1}\left(\frac{a}{p}\right)=0$ (where
$\left(\frac{a}{p}\right)$ is the Legendre symbol.)
ANSWER
We know $\left(\frac{0}{p}\right)=0$ by definition. We also know
that of the $p-1$ non-zero residues mod $p$, exactly half of them
are squares (viz. those which are even powers of a primitive
root), and the rest are non-squares. Thus
$\left(\frac{a}{p}\right)=1$ for exactly $\frac{(p-1)}{2}$ values
of $a$ with $1\leq a\leq p-1$, and $\left(\frac{a}{p}\right)=-1$
for the remaining $\frac{(p-1)}{2}$ values.
Hence $\sum_{a=0}^{p-1}\left(\frac{a}{p}\right)$ is a sum
consisting of one zero, $\frac{(p-1)}{2}\ +1$'s and
$\\frac{(p-1)}{2}\ -1$'s. Thus it is 0.
\end{document}