Currently dealing with a problem which contains a summation of squares modulo a prime, but I cannot find a reasoning online for it which isn't the sum of two squares problem due to matching terms.
The problem is finding where the following are true ($p \in \mathbb{P} \land p >2)$:
$ \sum_{k=1}^{p-1}{(k^2\mod{p})} = \sum_{k=1}^{p-1}{((k * (p - k))\mod{p})} = \sum_{k=1}^{p-1}{k} $
Here are the steps I have taken so far:
Obviously the rightmost side is trivial to determine as an arithmetic sum.
$ \sum_{k=1}^{p-1}{(k^2\mod{p})} = \sum_{k=1}^{p-1}{((k * (p - k))\mod{p})} = \frac{p(p-1)}{2} $
Since $k^2 \equiv (p-k)^2 \equiv p^2 - 2kp + k^2 \equiv k^2 \space ({}\mod{p})$ and $k(p-k) \equiv -k^2 \space ({}\mod p)$:
$ 2\sum_{k=1}^{\frac{p-1}{2}}{(k^2\mod{p})} = 2\sum_{k=1}^{\frac{p-1}{2}}{(-k^2\mod{p})} = \frac{p(p-1)}{2} $
And here is where I get stuck. I feel as though I've missed something dreadfully obvious here.
The constraint $p\equiv 1\pmod{4}$ ensures that if $a\in\{1,\ldots,p-1\}$ is a quadratic residue $\!\!\pmod{p}$ then $p-a$ is also a quadratic residue. Let us denote with $R$ the subset of $\{1,\ldots,p-1\}$ given by the quadratic residues $\!\!\pmod{p}$. Then $$ \sum_{k=1}^{p-1}\left(k^2\!\!\!\!\!\!\mod p\right)=2\sum_{r\in R}r=\sum_{r\in R}r+\sum_{r\in R}(p-r) = \sum_{k=1}^{p-1}k=\frac{p(p-1)}{2}. $$