<s>[INST] How to compute $\sum_{k=1}^n \frac{1}{\sin^2(\frac{k\pi}{2n+1})}$ efficiently? 
Compute $\sum_{k=1}^n \frac{1}{\sin^2(\frac{k\pi}{2n+1})}$ in terms of $n$.

Here's my way of doing it: using the classic expansion of $\sin((2n+1)x)$ as a polynomial in $\sin(x)$ we have:
$$\sin((2n+1)x) = \sum_{k=0}^n \binom{2n+1}{2k+1}(-1)^k\cos^{2(n-k)}(x)\sin^{2k+1}(x)$$
As a result, the $\sin(\frac{k\pi}{2n+1})$ with $k\in\{-n,\ldots,n\}$ are roots of the polynomial $$\displaystyle P(X) = \sum_{k=0}^n \binom{2n+1}{2k+1}(-1)^k(1-X^2)^{n-k}X^{2k+1}$$
Note that $\deg P=2n+1$ and we have found $2n+1$ distinct roots.
Consequently, the $\displaystyle \frac{1}{\sin(\frac{k\pi}{2n+1})}$ with $k\in\{-n,\ldots,n\}\setminus\{0\}$ are roots of $Q$, the reciprocal polynomial of $P$ (Note that $\deg Q = 2n $).
Since we're interested in the sum of squares of the roots of $Q$, it is enough to look for the coefficients of $X^{2n}$ and $X^{2n-2}$ in $Q$, which are the coefficients of $X$ and $X^3$ in $P$.
A tedious computation shows that these coefficients are respectively $2n+1$ and $-\binom{2n+1}{3}-n(2n+1)$.
Noting that the roots of $Q$ are symmetric and using the standard expansion $\displaystyle \left(\sum_i x_i\right)^2 = \sum_i x_i^2 + 2\sum_{i<j} x_i$ yields $$\sum_{k=1}^n \frac{1}{\sin^2(\frac{k\pi}{2n+1})} = \frac 23 n(n+1) $$


The path I followed looks like it can be shortened. Is there a quicker way to find a suitable polynomial that annihilates all the $\displaystyle \frac{1}{\sin^2(\frac{k\pi}{2n+1})}$ ?
Is there a shorter way altogether ?

 [/INST] It is enough to recall Cauchy's proof of the Basel problem, relying on the identity:
$$ \binom{2n+1}{1}t^n-\binom{2n+1}{3}t^{n-1}+\ldots+(-1)^n\binom{2n+1}{2n+1}=\prod_{k=1}^{n}\left(t-\cot^2\frac{k\pi}{2n+1}\right)\tag{1} $$
By Vieta's formulas,
$$ \sum_{k=1}^{n}\cot^2\left(\frac{\pi k}{2n+1}\right) = \binom{2n+1}{3} /\binom{2n+1}{1}=\frac{n(2n-1)}{3}\tag{2}$$
so:
$$ \sum_{k=1}^{n}\frac{1}{\sin^2\left(\frac{\pi k}{2n+1}\right)} = \frac{n(2n-1)}{3}+n=\color{red}{\frac{2}{3}n(n+1)}. \tag{3}$$
</s>