Perfect divisibility for products in modular arithmetic Say we have that 
$z^2 - x^2 = 0 \ ( \ mod \ p)$
that implies:
$p \ | \  (z-x)(z+x)$
However I was not 100% sure how that implies about the divisibility of p towards $(z-x)$ and/or $(z+x)$ and whether it depends if p is prime or not. The notes I was reading says that "because p is prime, then it divides $(z-x)$ or $(z+x)$". However, say that we have two numbers $n_1$ and $n_2$ and:
$$n_1n_2 = 0 \ ( \ mod \ p)$$ 
and thus:
$$p \ | \ n_1n_2$$
I thought that always implied, regardless of whether p is prime or not, that p either divided $n_1$ or $n_2$. Or am I wrong? Why does p have to be prime? I was suspecting that maybe it had something to do with having multiplicative inverses and $gcd(x,p) = 1$ only being true if p was prime, what I was not sure honestly.
Also, if n is composite, then what do we know if $n \ | \ n_1n_2$? Also, if n is composite, and we know $n \ | \ n_1n_2$, then, does it necessarily mean it must divide either $n_1$ or $n_2$?
I guess I am trying to understand the fundamental reason why p has to be prime for it to divide at least one of them (i.e. what makes p prime special).
Just for reference, this question came from solving the simple quadratic equation I wrote at the top and quadratic residues. 

You are on the right track. This divisibility property is true iff the divisor is prime, namely
Theorem $\ $ If $\,a>1\,$ is a natural number then 
$$a\ \ {\rm is\ prime}\,\ \iff\,\  a\mid bc\, \Rightarrow a\mid b\ \ {\rm or}\, \ a\mid c,\ \ {\rm for\ all}\,\ b,c\in \Bbb N$$
Proof $\ (\Rightarrow)\ \ $  If $\,a\,$ is prime and  $\,a\mid bc\,$ then $\,ad = bc\,$ for some $\,d\in \Bbb N.\,$ Taking prime factorizations of $\, ad = bc\,$ and invoking uniqueness of prime factorizations, we infer that the prime $\,a\,$ must occur in either the (unique) prime factorization of $\,b\,$ or $\,c,\,$ hence $\,a\mid b\,$ or $\,a\mid c.$ 
$(\Leftarrow)\ \ $ If $\,a\,$ is not prime then $\,a = bc,\,$ for some $\,1< b,c\in \Bbb N.\,$ Then $\,a\mid bc,\ $ but $\,a\nmid b,c.\ \ $ QED
