<s>[INST] Prove that $\sum\limits_{k=0}^{n-1}\dfrac{1}{\cos^2\frac{\pi k}{n}}=n^2$ for odd $n$ In old popular science magazine for school students I've seen problem

Prove that $\quad $
  $\dfrac{1}{\cos^2 20^\circ} + 
\dfrac{1}{\cos^2 40^\circ} + 
\dfrac{1}{\cos^2 60^\circ} + 
\dfrac{1}{\cos^2 80^\circ} = 40. $

How to prove more general identity:
$$
\begin{array}{|c|}
\hline \\
\sum\limits_{k=0}^{n-1}\dfrac{1}{\cos^2\frac{\pi k}{n}}=n^2 \\
\hline
\end{array}
,  \qquad \mbox{ where } \ n \ \mbox{ is odd.}$$
 [/INST] Since $n$ is odd, the numbers $u_k=\cos k\pi/n$ are the same as the numbers $\cos 2k\pi/n$, i.e. the distinct angles $\theta$ satisfying $n\theta=0$ (mod $2\pi$).  We think of them as the roots of the equation $\cos n\theta=1$.  Writing
$$\cos n\theta = \cos^n\theta - \binom{n}{2}\cos^{n-2}\theta\sin^2\theta \cdots \pm n\cos\theta \sin^{n-1}\theta$$
and using $\sin^2\theta=1-\cos^2\theta$, we see that the $u_k$'s are the roots of the polynomial
$$p(u)=u^n - \binom{n}{2}u^{n-2}(1-u^2) \pm n u(1-u^2)^{(n-1)/2} + 1.$$
Note that all powers of $u$ which occur are odd (except for the constant term).
The reciprocals $1/u_k$ are the roots of the "reverse polynomial"
$$r(u)=u^n p(1/u) = u^n + a_{n-1} u^{n-1} + \cdots,$$
where $a_{n-1}=\pm n$ and $a_{n-2}=0$.
The sum in question is the sum of the squares of the roots of $r(u)$, i.e. $a_{n-1}^2 - 2a_{n-2} = n^2$.
</s>