When is $2$ a quadratic residue mod $p$? 
For which prime numbers $p$ is $2$ a quadratic residue modulo $p$.

I know that $2$ is a quadratic residue iff 
$$2^{\frac{p-1}{2}} =1 \;  \bmod \;(p)
$$ so 
$$2^{p-1} =1 \;  \mod \; (p).
$$
But I don't know what to do.

The second supplementary law of quadratic reciprocity says that:
$$\biggl(\frac{2}p\biggr)=\bigl(-1\bigr)^{\tfrac{p^2-1}8}$$
Namely, $2$ is a square modulo $p$ if and only if $p\equiv\pm 1\mod 8$.
