2. Note that, if $p\equiv{1}(\bmod.4)$ then $-1$ is a qudratic residue, hence $\left(\tfrac{k}{p}\right)_L=\left(\tfrac{p-k}{p}\right)_L$ ( Legendre's Symbol)
Thus we find that $2S=\sum_{0\leq k. - the sum is taken over the quadratic residues-