TITLE: Prove the trigonometric identity $(35)$
QUESTION [12 upvotes]: Prove that 
\begin{equation}
\prod_{k=1}^{\lfloor (n-1)/2  \rfloor}\tan \left(\frac{k \pi}{n}\right)=  \left\{
      \begin{aligned}
       \sqrt{n} \space \space \text{for $n$ odd}\\
       \\
        \ 1 \space \space \text{for $n$ even}\\
      \end{aligned}
    \right.
\end{equation}
I found this identity here at$(35)$. At the moment I don't know where I should start from.
Thanks!

REPLY [3 votes]: I forgot that I had posted an answer to this question, and answered a duplicate question recently. Since this answer to the odd case is significantly different from the other answers, I have moved it here.

Note that
$$
\tan^2(\theta/2)=-\left(\frac{e^{i\theta}-1}{e^{i\theta}+1}\right)^2
$$
Therefore, for odd $n$,
$$
\begin{align}
\prod_{k=1}^{(n-1)/2}\tan^2(k\pi/n)
&=\prod_{k=1}^{(n-1)/2}(-1)\left(\frac{e^{2\pi ik/n}-1}{e^{2\pi ik/n}+1}\right)^2\\
&=\prod_{k=1}^{(n-1)/2}\left(\frac{e^{2\pi ik/n}-1}{e^{2\pi ik/n}+1}\right)\left(\frac{e^{-2\pi ik/n}-1}{e^{-2\pi ik/n}+1}\right)\\
&=\prod_{k=1}^{(n-1)/2}\left(\frac{e^{2\pi ik/n}-1}{e^{2\pi ik/n}+1}\right)\left(\frac{e^{2\pi i(n-k)/n}-1}{e^{2\pi i(n-k)/n}+1}\right)\\
&=\prod_{k=1}^{n-1}\frac{e^{2\pi ik/n}-1}{e^{2\pi ik/n}+1}\\
&=\prod_{k=1}^{n-1}\frac{1-e^{2\pi ik/n}}{1+e^{2\pi ik/n}}\\
&=\lim_{z\to1}\prod_{k=1}^{n-1}\frac{z-e^{2\pi ik/n}}{z+e^{2\pi ik/n}}\\
&=\lim_{z\to1}\frac{z^n-1}{z-1}\frac{z+1}{z^n+1}\\[12pt]
&=n
\end{align}
$$
Since tangent is positive in the first quadrant,
$$
\prod_{k=1}^{(n-1)/2}\tan(k\pi/n)=\sqrt{n}
$$