How does $x^4-2x^3-2x+1$ factor in $\mathbb{F}_{p}$? I've been struggling to prove the general formula for how the polynomial in the title factors mod $p$, for some arbitrary prime $p$. This is how it must factors, although I should mention this "guess" wasn't formulated by factoring for some primes and then assuming any pattern notice held;
$x^4-2x^3-2x+1=Q_{1}\cdot L_{1} \cdot L_{2}$ if $p \equiv 11 \pmod{12}$
$x^4-2x^3-2x+1=Q_{1}\cdot Q_{2}$ if $p \equiv 7 \pmod{12}$
$x^4-2x^3-2x+1=Qu_{1}$ if $p \equiv 5 \pmod{12}$
$x^4-2x^3-2x+1=L_{1} \cdot L_{2} \cdot L_{3} \cdot L_{4}$ if $p = a^2+36 b^2$
$x^4-2x^3-2x+1=Q_{1}\cdot Q_{2}$ if $p=4a^2+9b^2$
Where $Q, L, Qu$ are irreducible in $\mathbb{F}_{p}$, and  $Q_{i}, L_{j}, Qu_{k}$ are quadratic, linear, and quartic polynomials respectively. I'm working on various other polynomials too of varying degree as well, all with solvable Galois Groups. Any help as to how to factor them like this formula would be much appreciated.
 A: The polynomial is reciprocal, so there is an easy way of solving the corresponding equation: dividing through by $x^2$ gives
$$ x^2 - 2x - \frac{2}{x} + \frac1{x^2} 
  = \Big(x + \frac1x\Big)^2 - 2 \Big(x + \frac1x\Big) - 2 = 0,$$
hence
$$ x + \frac1x = 1 \pm \sqrt{3}. $$
Multiplying through by $x$ gives the quadratic
$$ x^2 - \omega x + 1 = 0, $$
where $\omega = 1 \pm \sqrt{3}$. This shows that the field generated by the roots of the polynomial is ${\mathbb Q}(\sqrt{2\sqrt{3}}) = {\mathbb Q}(\sqrt[4]{12})$.
The remaining calculations involve quadratic and quartic reciprocity for describing the splitting of primes in pure quartic extensions. 
As an example, look at the normal closure of ${\mathbb Q}(\sqrt[4]{12})$,
 which is $L = {\mathbb Q}(i, \sqrt[4]{-3})$. Its maximal abelian subfield $F$ is the field of $12$-th roots of unity, hence exactly the primes $p \equiv 1 \bmod 12$ split  in $F$. Among these primes, the ones splitting completely in $L$ are exactly those for which $-3$ is a quartic residue modulo $p$. By classical criteria due to Gauss this happens if and only if $p = a^2 + 4b^2$ for $b$ divisible by $3$.
A direct approach for describing the splitting of primes in dihedral extensions using binary quadratic forms requires the concept of ring class fields. You might want to look into Cox's book on primes of the form $x^2 + ny^2$, where this is explained in detail.
