Proving $\frac{1}{\sin^{2}\frac{\pi}{14}} + \frac{1}{\sin^{2}\frac{3\pi}{14}} + \frac{1}{\sin^{2}\frac{5\pi}{14}} = 24$
The roots idea should work, but first convert to $\cos$ using the formula $1 - 2\sin^2 x = \cos 2x$.
You will need to get a polynomial of which $\cos (2k+1)\pi/7$ is a root (polynomial corresponding to $\cos 7\theta = -1$) and you are interested in finding out $\sum \frac{1}{1-r}$ over the roots $r$. By using the fact that $\cos 5\pi/7 = \cos 9\pi/7$ etc, you get your sum.
To complete it,
We have that the Chebyshev Polynomial $T_7(\cos x) = \cos 7x$
Thus the polynomial we seek is $\displaystyle Q(x) = T_7(x)+1 = 64x^7 - 112 x^5 + 56x^3 -7x +1$
Its roots are $\cos (2k+1) \pi /7$, $0 \le k \le 6$.
For any polynomial $P(x)$ with roots $r_1, r_2, \dots, r_n$ we have by differentiating $\log P(x)$ that
$$ \sum_{j=1}^{n} \frac{1}{x - r_j} = \frac{P'(x)}{P(x)}$$
Thus the value we seek is $\displaystyle \frac{Q'(1)}{Q(1)} - \frac{1}{2}$ (one of the roots is $\cos \pi = -1$) and this can easily be calculated to be $24$.
Use $\sin(x) = \cos(\frac{\pi}2 - x)$, we can rewrite this as:
$$\frac{1}{\cos^2 \frac{3\pi}{7}} + \frac{1}{\cos^2 \frac{2\pi}{7}} + \frac{1}{\cos^2 \frac{\pi}{7}}$$
Let $a_k = \frac{1}{\cos \frac{k\pi}7}$.
Let $f(x) = (x-a_1)(x-a_2)(x-a_3)(x-a_4)(x-a_5)(x-a_6)$.
Now, using that $a_k = - a_{7-k}$, this can be written as:
$$f(x) = (x^2-a_1^2)(x^2-a_2^2)(x^2-a_3^2)$$
Now, our problem is to find the sum $a_1^2 + a_2^2 + a_3^2$, which is just the negative of the coefficient of $x^4$ in the polynomial $f(x)$.
Let $U_6(x)$ be the Chebyshev polynomial of the second kind - that is:
$$U_6(\cos \theta) = \frac{\sin 7\theta }{\sin \theta}$$
It is a polynomial of degree $6$ with roots equal to $\cos(\frac{k\pi}7)$, for $k=1,...,6$.
So the polynomials $f(x)$ and $x^6U_6(1/x)$ have the same roots, so:
$$f(x) = C x^6 U_6(\frac{1}x)$$
for some constant $C$.
But $U_6(x) = 64x^6-80x^4+24x^2-1$, so $x^6 U_6(\frac{1}x) = -x^6 + 24 x^4 - 80x^2 + 64$. Since the coefficient of $x^6$ is $-1$, and it is $1$ in $f(x)$, $C=-1.$ So:
$$f(x) = x^6 - 24x^4 +80x^2 - 64$$
In particular, the sum you are looking for is $24$.
In general, if $n$ is odd, then the sum:
$$\sum_{k=1}^{\frac{n-1}2} \frac{1}{\cos^2 \frac{k\pi}{n}}$$
is the absolute value of the coefficient of $x^2$ in the polynomial $U_{n-1}(x)$, which turns out to have closed form $\frac{n^2-1}2$.
Another method would involve use of complex numbers.
** added **
OK, elaboration.
Let $w = \exp(i \pi/14)$ so that $w^7 = i$. In (1) I factored $w^7-i$ and in (2) obtained the relation satisfied by $w$. (3) is what we want to compute. (4) is the relations of the trig functions to $w$. In (5) we wrote the thing to compute in terms of $w$. In (6) we took the denominator, and reduced it using the relation satisfied by $w$. In (7) the same thing for the numerator. So (8) is our answer, which is simplified in (9).
We can derive $\cos7x=64c^7-112c^5+56c^3-7c$ where $c=\cos x$(Proof Below)
If $\cos7x=0, 7x=\frac{(2r+1)\pi}2,x=\frac{(2r+1)\pi}{14}$ where $r=0,1,2,3,4,5,6$
So, the roots of $64c^7-112c^5+56c^3-7c=0$ are $\cos\frac{(2r+1)\pi}{14}$ where $r=0,1,2,3,4,5,6$
So, the roots of $64c^6-112c^4+56c^2-7=0$ are $\cos\frac{(2r+1)\pi}{14}$ where $r=0,1,2,4,5,6$ as $\cos x=c=0$ corresponds to $r=3$
So, the roots of $64d^3-112d^2+56d-7=0$ are $\cos^2\frac{(2r+1)\pi}{14}$ where $r=0,1,2$ or $r=4,5,6$ as $\cos \frac{(7-k)\pi}7=\cos(\pi-\frac{k\pi}7)=-\cos\frac{k\pi}7$
If $$y=\frac1{\sin^2\frac{(2r+1)\pi}{14}}, y=\frac1{1-d}\implies d=\frac{y-1}y$$
So, the equation whose roots are $\frac1{\sin^2\frac{(2r+1)\pi}{14}}$ where $r=0,1,2$ is $$64\left(\frac{y-1}y\right)^3-112\left(\frac{y-1}y\right)^2+56\left(\frac{y-1}y\right)-7=0$$
On simplification, $y^3(64-112+56-7)+y^2\{64(-3)-112(-2)+56(-1)\}+y()+()=0$
So using Vieta's Formulas, $$\sum_{r=0}^2\frac1{\sin^2\frac{(2r+1)\pi}{14}}=\frac{24}1$$
[
Proof:
(1) Using $\cos C+\cos D=2\cos\left(\frac{C-D}2\right)\cos\left(\frac{C+D}2\right)$
$$\cos7x+\cos x=2\cos3x\cos4x=2\cos3x(2\cos^22x-1)\text{ using }\cos2y=2\cos^2y-1$$
$$\text{ So, }\cos7x=-c+2(4c^3-3c)\{2(2c^2-1)^2-1\} \text{ using } \cos3y=4\cos^3y-3\cos y \text{ where } c=\cos x$$ $$\cos 7x=-c+(8c^3-6c)(8c^4-8c^2+1)=64c^7-112c^5+56c^3-7c$$
(2) Alternatively using de Moivre's formula,
$$\cos 7x+i\sin7x=(\cos x+i\sin x)^7$$
Expanding and equating the real parts $\cos7x=c^7-\binom72c^5s^2+\binom72c^3s^4-\binom76cs^6$ where $c=\cos x,s=\sin x$
So, $\cos7x=c^7-\binom72c^5(1-c^2)+\binom72c^3(1-c^2)^2-\binom76c(1-c^2)^3$
]