When $p=2$ or $p$ prime, with $p=1\pmod{4}$, $x^2\equiv -1\pmod{p}$ is soluble - trouble understanding proof Theorem: When $p=2$ or $p$ prime, with $p=1\pmod{4}$, $x^2\equiv -1\pmod{p}$ is soluble
Proof: When $p=2$, the statement is clear.
Assume $p\equiv 1\pmod{4}$, let $r=\frac{p-1}{2}$ and $x=r!$
Then since $r$ is even $x^2\equiv (1\cdot 2\cdot...\cdot r)((p-1)\cdot(p-2)\cdot...\cdot(p-r))\equiv (p-1)!\equiv -1\pmod{p}$
Thus, when $p\equiv 1\pmod{4}$, the congruence $x^2\equiv -1\pmod{p}$ is soluble.
Point of contention: I understand the general argument
I understand the relation
$(1\cdot 2\cdot...\cdot r)((p-1)\cdot(p-2)\cdot...\cdot(p-r))\equiv (p-1)!\equiv -1\pmod{p}$
But I cant work out how $x^2\equiv(1\cdot 2\cdot...\cdot r)((p-1)\cdot(p-2)\cdot...\cdot(p-r))\pmod{p}$
How is $((\frac{p-1}{2})!)^2\equiv(1\cdot 2\cdot...\cdot r)((p-1)\cdot(p-2)\cdot...\cdot(p-r))\pmod{p}$

For any $i$, $p-i\equiv -i\pmod{p}$, so the right-hand side of your final congruence is
\begin{equation*}
  (1\cdot 2\cdot...\cdot r)((p-1)\cdot(p-2)\cdot...\cdot(p-r))
    \equiv (1\cdot 2\cdot...\cdot r)((-1)\cdot(-2)\cdot...\cdot(-r))
    \equiv r!(-1)^rr! \equiv (-1)^r(r!)^2\pmod{p}.
\end{equation*}
But since $p\equiv 1\pmod{4}$, it follows that $r = \frac{p-1}{2}$ is even, so this is just $(r!)^2 = \left(\left(\frac{p-1}{2}\right)!\right)^2\pmod{p}$.
