First of all, sorry for my bad English.
I am looking for a general method to know for which primes $p$ a specific polynomial factorize in $Z_p[x]$.
For example my teacher considers $(x^3-1)=(x-1)(x^2+x+1)$ and wants to factorize $x^2+x+1$. He considers $p=5$ and replaces all elements of $Z_5$ instead of $x$; $x^2+x+1$ is never zero, so does not factorize. For $p=13$ he obtains zero, so in $Z_{13}$ the polynomial factorizes. Then he proves that it is possible to factorize $x^2+x+1$ in $Z_p$ if and only if $p \equiv 1 \pmod{3}$. In the first direction of the proof (polynomial factorize in $Z_p$ implies $p \equiv 1 \pmod{3}$) he takes a $z$ in $Z_p$ that is a zero for $x^2+x+1$ and implies that $z^3 \equiv 1 \pmod{p}$. Why?
If I have a different polynomial in $Z_p$ there is a general method to determine the equivalence class of $p$ like in the example? It maybe involves the polynomial's degree?
Thanks for your help!