The first observation follows from the law of quadratic reciprocity. Indeed, assume that $p\equiv 1\pmod{8}$ and $p=A^2+B^2$. Let $A'$ denote the odd part of $A$. Then $p\equiv B^2\pmod{A'}$, and hence $\left(\frac{p}{A'}\right)=1$. It follows that $\left(\frac{A'}{p}\right)=1$, and then by $\left(\frac{2}{p}\right)=1$ also $\left(\frac{A}{p}\right)=1$. In the same way, $\left(\frac{B}{p}\right)=1$. The second observation lies deeper. I will use Gerry Meyerson's helpful comment below the original post. For any prime $p=4n+1$, Gauss (1825) observed that $p=A^2+B^2$, where $A$ and $B$ are the absolute least residues modulo $p$ of $(2n)!/(2n!^2)$ and $(2n)!^2/(2n!^2)$. For a proof, see [Jacobsthal (1907)][1] or [Barnes (1974)][2]. Hence it suffices to show that in case when $4$ divides $n$, these two integers are fourth powers modulo $p$. So let us assume that $4\mid n$. By Wilson's theorem, $$(2n)!^{(p-1)/4}=(2n)!^{n}\equiv(p-1)!^{n/2}\equiv(-1)^{n/2}=1\pmod{p}.$$ Therefore, $(2n)!$ is a fourth power modulo $p$, and we only need to prove that $2n!^2$ is a fourth power modulo $p$. This is equivalent to $$2^{(p-1)/4}n!^{(p-1)/2}\equiv 1\pmod{p}.$$ Now $2$ is a square modulo $p$, hence $2^{(p-1)/4}\equiv\pm 1\pmod{p}$ depending on whether $2$ is a fourth power modulo $p$ or not. So we need to show that $$\left(\frac{n!}{p}\right)=\left(\frac{2}{p}\right)_4.\tag{$\ast$}$$ However, this follows from Theorem 5 in Emma Lehmer's 1977 paper "Generalizations of Gauss's lemma" applied to the quadratic non-residues in $[1,2n]$, and we are done. To make this post more self-contained, I spell out the relevant case of Emma Lehmer's theorem. Let $a_1,\dotsc,a_\nu$ be the quadratic non-residues in $[1,n]$, and let $a_{\nu+1},\dotsc,a_n$ be the quadratic non-residues in $[n+1,2n]$. Then $2a_1,\dotsc,2a_\nu$ are the even quadratic non-residues in $[2,2n]$, and $p-2a_{\nu+1},\dotsc,p-2a_n$ are the odd quadratic non-residues in $[1,2n-1]$. It follows that $$\prod_{i=1}^n a_i=\prod_{i=1}^\nu(2a_i)\prod_{i=\nu+1}^n(p-2a_i).$$ Taking residues modulo $p$ on both sides, we obtain after simplification that $$1\equiv 2^\nu(-2)^{n-\nu}\pmod{p}.$$ Using also that $n$ is even, we arrive at $(-1)^\nu\equiv 2^n\pmod{p}$, which is equivalent to $(\ast)$. [1]: https://gdz.sub.uni-goettingen.de/download/pdf/PPN243919689_0132/LOG_0017.pdf [2]: https://www.e-periodica.ch/cntmng?pid=ens-001%3A1974%3A20%3A%3A9