Complete factorisation of $x^8-2x^4\cos (4\theta)+1$ with roots of unity 
Factorize completely $x^8-2x^4\cos (4\theta)+1$ using complex numbers and $n$-th root of unity.

The answer given is
$$\prod_{r=0}^3 \left(x^2-2x\cos\left(\theta+\frac{r\pi}{2}\right)+1\right)\,.$$
Can anyone please help . I just want to know how to tackle this . I just want the conceptual trick to solve such sum.

With the 4th root of unity $e^{\pm i\frac{a+2\pi r}4} $ for $x^4 - e^{\pm ia}=0$, factorize as follows
\begin{align}
x^8-2x^4\cos  (4\theta)+1 
=&\> (x^4-e^{i 4\theta})(x^4-e^{-i 4\theta}) \\
= &\prod_{r=0}^{3}(x-e^{i\frac{4\theta+2\pi r}4})
 \prod_{r=0}^{3}(x-e^{-i\frac{4\theta+2\pi r}4})  \\
 = &\prod_{r=0}^{3}(x-e^{i(\theta+ \frac{\pi r}2)})
  (x-e^{-i(\theta+ \frac{i\pi r}2)}) \\
= &\prod_{r=0}^{3}(x²-2x\cos(\theta+\frac{\pi r}{2})+1)
\end{align}
