How do we factor polynomials that are in $\mathbb{Z}_m$ (congruence classes) I'm really confused, or maybe overthinking it, but how would I factor something like $x^4+2x-4$ in $\mathbb{Z}_5[x]$?

$\,a\equiv0\,$ is not a root. If $\,a\not\equiv 0\,$ then by Fermat $\,\color{#c00}{a^4\equiv 1}\,$ so $\,0\equiv f(a)\equiv \color{#c00}{a^4}+2a+1\equiv 2a+2,\,$ so $\,a\equiv -1\,$ is the only root of $\,f.\,$ Thus $\,f(x) = (x+1)g(x),\,$ and $\,g\,$ is irreducible, being a cubic with no roots (note $\,g(-1)\not\equiv 0\,$ by $\,f'(-1)\not\equiv 0,\,$ so $\,-1\,$ is not a double root of $\,f).$
