Factorization of $f(x) = x^n - 1$ into irreducible polynomials $\mathbb{R}[x]$ Knowing that $e^{2\pi i \frac{k}{n}} = \cos(2 \pi k/n) + i \sin(2 \pi k/n) = \alpha $ is complex roots of $f(x) = x^n - 1$ and therefore the complex factorization is
\begin{align}
    f(X) &= \displaystyle\prod^{n - 1}_{k = 0} (x - \alpha_k)
\end{align}
How do I factorize into irreducible polynomials in $\mathbb{R}$ for odd and even n's? I know that for $(x-1) \mid f(x)$ for all n and if n is even $(x+1)\mid f(x)$ as well. I'm also aware that $(x - \alpha)(x-\bar{\alpha})$ is an irreducible polynomial in $\mathbb{R}$ that also divides $f(x)$. So the remaining factors most take the form $x^2 - 2x\cos(2 \pi k/n) + 1$. But I fail to see which k's to use in the factorization?
 A: Very simply, you have two cases:

*

*If $n$ is even: $n=2m$, the complex roots are pairwise conjugate, except for $k=0$ and $k=m$, so the factorisation is
$$x^{2m}-1=(x-1)(x+1)\prod_{k=1}^{m-1}\Bigl(x^2-2\cos\frac{2k\pi}n x+1\Bigr).$$

*If $n$ is odd: $n=2m+1$, they're pairwise conjugate, except for $k=0$, so we obtain
$$x^{2m+1}-1=(x-1)\prod_{k=1}^{m}\Bigl(x^2-2\cos\frac{2k\pi}n x+1\Bigr).$$
A: If I understand your question correctly, if $\exp[2\pi ik/n]$ has a non-zero imaginary component, re $\sin[2\pi k/n]$, then you have to combine it with its complex conjugate.  Otherwise, you can leave it alone.
Addendum
Responding to the OP's comment:
Let $c_1 \equiv \cos(2\pi/5), ~c_2 \equiv \cos(4\pi/5).$ 
Let $s_1 \equiv \sin(2\pi/5), ~s_2 \equiv \sin(4\pi/5).$
Then $(z^5 - 1)$ factors into 
$(z-1) ~\times $ 
$(z - [c_1 + i(s_1)]) ~\times~ (z - [c_1 - i(s_1)]) ~\times $ 
$(z - [c_2 + i(s_2)]) ~\times (z - [c_2 - i(s_2)]).$
This equals 
$(z-1) ~\times $ 
$[z^2 - (2c_1)z + ([c_1]^2 + [s_1]^2)] ~\times~ $ 
$[z^2 - (2c_2)z + ([c_2]^2 + [s_2]^2)].$
This equals 
$(z-1) ~\times $ 
$[z^2 - (2c_1)z + (1)] ~\times~ $ 
$[z^2 - (2c_2)z + (1)].$
