Let $p$ be an odd prime. We know that the polynomial $x^{p-1}-1$ splits into linear factors modulo $p$. If $p$ is of the form $4k+1$ then we can write $$x^{p-1}-1=x^{4k}-1=(x^{2k}+1)(x^{2k}-1).$$ The theorem of Lagrange tells us that any polynomial congruence of degree $n$ mod $p$ has at most $n$ solutions. Hence we can deduce from this factorization that $-1$ is a quadratic residue modulo $p$. Similarly if $p$ is of the form $3k+1$ we can write $4(x^{p-1}-1)=4(x^{3k}-1)=(x^k-1)((2x^{k}+1)^2+3)$ and deduce that $-3$ is a quadratic residue mod $p$.
Can we prove in this fashion that $-2$ is a quadratic residue mod $p$ if $p$ is of the form $8k+1$ or $8k+3$?
Note that I am interested only in this specific method. I know how to prove this using different means.
In the case $p = 8k+1$, one can write $$x^{p-1} - 1 = (x^{4k}-1)(x^{4k}+1) = (x^{4k}-1)((x^{2k}+1)^2+2(x^{2k})) \,.$$
Now for any $x$ such that $(x^{2k}+1)^2+2(x^{2k}) = 0$, we see that $y = (x^{2k}+1)/x^k$ satisfies $y^2 = -2$.
I think that this method breaks down in cases of the form $p= 8k+3$. For $k=1$, the resulting polynomial to factor is $x^{10}-1$. However, the corresponding cyclotomic extension field $\Bbb Q(e^{i\pi/5})$ does not include $\Bbb Q(\sqrt{-2})$ as a subfield (its Galois group is cyclic of order 4, with $\Bbb Q(\sqrt{5})$ as the only quadratic subfield), which I think implies that there's no comparable decomposition for $x^{10}-1$.
Note: while looking at that example, I did find that if $p$ is of the form $5k+1$ then you can factor $$4(x^{p-1}-1) = 4x^{5k}-4 = (x^k-1)(4x^{4k}+4x^{3k}+4x^{2k}+4x+4) =(x^k-1)((2x^{2k}+x^k+2)^2 - 5x^{2k})\,. $$ Similar reasoning to the above shows that in this case 5 is a quadratic residue mod $p$.