We still need to show that there are no more than 2 solutions. For this, we use a bit of field theory. Consider the polynomial $\displaystyle x^2-a$ in $\displaystyle \mathbb Z/p\mathbb Z[x].$ As $\displaystyle \mathbb Z/p\mathbb Z$ is a field, $\displaystyle \mathbb Z/p\mathbb Z[x].$ is a unique-factorization domain. In a UFD, any polynomial of degree $\displaystyle n$ cannot have more than $\displaystyle n$ roots. Hence the quadratic polynomial $\displaystyle x^2-a$ can have at most 2 roots modulo $\displaystyle p.$ Hence there are at most 2 solutions to the equation $\displaystyle x^2\equiv a\pmod p.$

Combining the results, we see that $\displaystyle x^2\equiv a\pmod p$ has exactly 2 solutions whenever it is solvable.