It is easily proved that over the polynomial ring \mathbb{C[X]} we have \prod_{i=1}^{n-1}\left ( X^2 - 2X \cos \frac{i \pi}{n} +1 \right ) = \frac{X^{2n} - 1}{X^2 - 1}
Divide both sides by X^{n-1} to get that \prod_{i=1}^{n-1}\left ( X - 2 \cos \frac{i \pi}{n} + \frac{1}{X} \right ) = \frac{X^{n} - \frac{1}{X^{n}}}{X - \frac{1}{X}}
Put X = \cos \theta + i \sin \theta to get
2^{n-1} \prod_{i=1}^{n-1}\left ( \cos \theta - \cos \frac{i \pi}{n} \right ) = \frac{\sin n \theta}{ \sin \theta}
Put
\theta = \frac{\pi}{2} to get
\prod_{i=1}^{n-1}\left ( \cos \frac{i \pi}{n} \right ) = (-1)^{n-1}\frac{\sin \frac{n \pi}{2} }{2^{n-1} } = \frac{\sin \frac{n \pi}{2} }{2^{n-1} }