How many quadratic residues are there modulo $p$?
$X^{p-1}-1=\left(X^{(p-1) / 2}-1\right)\left(X^{(p-1) / 2}+1\right)$ so $X^{(p-1) / 2}-1$ has $(p-1) / 2$ roots. Therefore, there are $(p-1) / 2$ quadratic residues modulo $p$.

Theorem 60 (Gauss's Lemma). Let $p$ be an odd prime and $a$ be coprime with $p$. We look at the residues modulo $p$ of $a, 2a, \cdots, \left(\frac{p-1}{2}\right)a$, of which there are $n$ that are greater than $p / 2$. Then $\left(\frac{a}{p}\right)=(-1)^{n}$.

Proof. We will evaluate the product $a \cdot 2a \cdots \frac{p-1}{2}a$ modulo $p$. On one hand, it is equal to $a^{\frac{p-1}{2}}\left(\frac{p-1}{2}\right)!$. On the other hand, define $|x|=x$ if $0<x<p / 2$, and $p-x$ otherwise. Then the product is $(-1)^{n}|a| \cdot|2a| \cdots\left|\frac{p-1}{2}a\right|$. We observe that the $|ka|$ are all distinct and less than $p / 2$, so they are a permutation of $1,2, \cdots, \frac{p-1}{2}$. Therefore, the product is also equal to $(-1)^{n}\left(\frac{p-1}{2}\right)!$, hence the result.

Proposition 61. $\left(\frac{-1}{p}\right)=1$ if and only if $p \equiv 1 \bmod 4$.

Proposition 62. $\left(\frac{2}{p}\right)=(-1)^{\left(p^{2}-1\right) / 8}$.

Proof. Use Gauss's Lemma by distinguishing according to the value of $p$ modulo 8.