I'm reflecting the following proof (see below). My question is where it uses the given fact ($p \not\equiv 3 \pmod 4$)? I'm not sure it uses this fact, and it kind of makes me think that something is wrong. Would appriciate your help.
Draft of a possible partial proof. Let $p = 3 \pmod 4$ be a prime number. Assume that $p = a^2 + b^2$. Then $a^2 + b^2 = 0 \pmod p$, implying that $a^2 = -b^2 \pmod p$. By raising both sides in $(p-1)/2$, then using Fermat's little theorem we saw in problem set 6, we conclude that $p \mid 2$.
I assume there is a typo in the question. If $p \equiv 1 \pmod{4}$, $(p-1)/2$ is a even number so you would get $1 \equiv 1 \pmod{p}$ which is not a contradiction. Only when $(p-1)/2$ is odd, you would get $ 1 \equiv -1 \pmod{p}$.