<s>[INST] For which primes $p\not=2$ is $5$ a square mod $p$? For which primes $p\not=2$ is $5$ a square mod $p$?

Using the Legendre symbol, $5$ is a square modulo $p$ if
$$\left(\frac{5}{p}\right)=5^{\dfrac{p-1}{2}} \equiv 1 \pmod{p}$$
Now we have
$$5^{\dfrac{p-1}{2}} = 
(5^{p-1})^{1/2} \equiv 1\pmod{p}$$
So $5$ is a square for any $p$. But this doesn't seem correct to me. Can anyone check this and if it's wrong, explain why.
 [/INST] You can't take the square root like this. By Fermat's little theorem, we know that for $p$ prime we have that $5^{p-1} \equiv 1 \mod p$. This means that $p \mid 5^{p-1} -1$, and hence $$p \mid \left(5^{\tfrac{p-1}{2}} -1\right)\left(5^{\tfrac{p-1}{2}} +1\right)$$
Therefore $5^{\tfrac{p-1}{2}} \equiv 1 \mod p$ or $5^{\tfrac{p-1}{2}} \equiv -1 \mod p$.
Note that if $p$ is not prime, there can be even more possibilities. 

Note that for every odd prime $p$ we have $2 \mid p-1$. Also $4 \mid 5-1$. So $2 \mid \left(\frac{p-1}{2} \cdot \frac{5-1}{2} \right)$. Hence by quadratic reciprocity we have $$\left( \frac{p}{5} \right)\left( \frac{5}{p} \right) = (-1)^{\frac{p-1}{2} \cdot \frac{5-1}{2}} = 1$$
So $\left( \frac{p}{5} \right) =1$ if $\left( \frac{5}{p} \right)=1$, and the latter happens when $p\equiv 1 \mod 5$ or $p \equiv 4 \mod 5$. 
Note that one can not use the law if $p=5$, since the law of  quadratic reciprocity requires $p$ and $q$ to be different primes. Whether $p=5$ is a quadratic residue depends on the definition of quadratic residue. 
</s>