By little Fermat, we know that for any $a\neq 0$ in $\Bbb Z_p^\times$ we have $a^{p-1}=1$. This means that $a^{\frac{p-1}2}=\pm 1$. It is a theorem that in $\Bbb Z_p^{\times}$, exactly half of the elements are squares (namely, those that correspond to $1^2,2^2,\ldots,\left(\frac{p-1}2\right)^2$) and half are non-squares. But by Lagrange's theorem, $a^{\frac{p-1}2}=1$ has at most $\dfrac{p-1}2$ solutions and by the previous claim at least $\dfrac{p-1}2$ solutions. Thus, it has exactly $\dfrac{p-1}2$ solutions, the squares $\mod p$. Thus if $a=b^2$ the equations holds, and if $a$ is not a square the equation doesn't.
ADD Using $\Bbb Z_p^\times$ is cyclic. Let $g$ be a primitive root modulo $p$. We can write $a=g^k$ for some $k$. By $g^{k(p-1)/2}=1$, it follows that ${\rm ord}(g)=p-1\mid (p-1)k/2$. This gives $k/2$ is an integer, so $k=2m$, and $a=g^{2m}=g'^2$ where $g'=g^m$.