$1,2,4$ can be dealt easily.
For $p^m$ divides $(x^2-1)=(x-1)(x+1)$
Now, $x+1-(x-1)=2\implies (x-1,x+1)$ divides $2$
So, either $p^m$ divides $(x-1)$ or $(x+1)$ resulting in exactly $2$ in-congruent solutions
If $2\cdot p^m$ divides $(x^2-1)=(x-1)(x+1)$
Clearly, $x$ is odd
So, $p^m$ divides $\frac{x-1}2\cdot\frac{x+1}2$
Now, $-\frac{x-1}2+\frac{x+1}2=1\implies (\frac{x+1}2,\frac{x-1}2)=1$
So, either $p^m$ divides $\frac{x-1}2$ or $\frac{x+1}2$ resulting in exactly $2$ in-congruent solutions
Alternatively, f $x^d\equiv1\pmod m$ and $m$ has a primitive root $a$
Taking Discrete logarithm, $d\cdot ind_ax\equiv ind_a1\pmod {\phi(m)}\equiv0$
Using Linear congruence theorem, it has exactly $(d,\phi(m))$ solutions as $(d,\phi(m))$ divides $0$
Every quadratic residue is of the form $k^2$ for a $k \in \{1,\,\dotsc,\, \frac{p-1}{2}\}$. So the product of quadratic residues is
$$\prod_{k=1}^{\frac{p-1}{2}} k^2.$$
Now relate that to Wilson's theorem: Since $k^2 \equiv (-1)\cdot k \cdot (p-k) \pmod{p}$, we have
$$\prod_{k = 1}^{\frac{p-1}{2}}k^2 \equiv (-1)^{\frac{p-1}{2}}\prod_{k = 1}^{\frac{p-1}{2}} k \cdot \prod_{k = 1}^{\frac{p-1}{2}}(p-k) =(-1)^{\frac{p-1}{2}}\cdot (p-1)! \equiv (-1)^{\frac{p+1}{2}}\pmod{p}.$$
Thus the product of quadratic residues modulo $p$ is $\equiv 1 \pmod{p}$ if $p \equiv 3 \pmod{4}$ and it is $\equiv -1\pmod{p}$ if $p \equiv 1 \pmod{4}$.
Best Answer
For any $x$ between $1$ and $p-1$, let $f(x)$ be the remainder when $x^3$ is divided by $p$/
We show that the function $f(x)$ is one to one. It will follow that $f(x)$ is onto. That implies that for any $\alpha$ between $1$ and $p-1$ there is a $\beta$ such that $\beta^3\equiv \alpha\pmod{p}$.
To show $f$ is one to one, we show that if $x^3\equiv y^3\pmod{p}$, then $x\equiv y\pmod{p}$. Equivalently, we need to show that if $z^3\equiv 1\pmod{p}$ then $z\equiv 1\pmod{p}$.
This is easy. Since $z^3\equiv 1\pmod{p}$, the order of $z$ must divide $3$. We show it cannot be $3$ so must be $1$. The order of $z$ modulo $p$ divides $p-1$. But if $p\equiv 2\pmod{3}$ then $3$ cannot divide $p-1$.