How do you find the sum: $\sum_{r=1}^6 \tan^2\left(\frac{r \pi}{n}\right)$ How do you find the sum: $$\sum_{r=1}^6 \tan^2\left(\frac{r \pi}{n}\right)$$
I managed to solve this question using complex numbers so I thought I'd share the solution. If you know of any better method of solving it, please do share.

Let $x=\frac{\pi}{7}:$
$$(\cos x + i \sin x)^7 = \cos 7x + i \sin 7x$$
Since $\sin 7x$ = Imaginary part of $(\cos x + i \sin x)^7$
$$\sin7x = \sum_{r=0}^3 \binom{7}{2r+1}(\cos x)^{7-(2r+1)} \cdot(i\sin x)^{2r+1} $$
We also know that $\sin 7x = 0$
$$0 =  \binom{7}{1}(\cos x)^{6} (\sin x)^{1} -\binom{7}{3}(\cos x)^{4} (\sin x)^{3}+\binom{7}{5}(\cos x)^{2} (\sin x)^{5}-\binom{7}{7}(\cos x)^{0} (\sin x)^{7}$$
$$0 =  7(\cos x)^{6} (\sin x)^{1} -35(\cos x)^{4} (\sin x)^{3}+21(\cos x)^{2} (\sin x)^{5}-(\cos x)^{0} (\sin x)^{7}$$
$$0 =  7\tan x - 35\tan^3 x + 21\tan^5 x - \tan^7 x$$
$$0 =  \tan^6 x - 21\tan^4 x + 35\tan^2 x -7$$
Since the roots of the above equation are $\tan \frac{\pi}{7},\tan \frac{2\pi}{7},\tan \frac{3\pi}{7},\tan \frac{4\pi}{7},\tan \frac{5\pi}{7},\tan \frac{6\pi}{7}$
and $\tan \frac{\pi}{7}$=$-\tan \frac{6\pi}{7}$, on pairing the roots of the equation, we have:
$$\left(\tan^2 x - \tan^2 \frac{\pi}{7}\right)\left(\tan^2 x - \tan^2 \frac{2\pi}{7}\right)\left(\tan^2 x - \tan^2 \frac{3\pi}{7}\right)=0$$
Hence we have an equation in $\tan^2 x$. The given question requires us to find 2 times the sum of the roots, since 
$$\sum_{r=1}^6 tan^2\left(\frac{r \pi}{n}\right)=2\sum_{r=1}^3 tan^2\left(\frac{r \pi}{n}\right)$$
Thus we find the required sum as: 
$$2\left(\frac{-b}{a}\right) = 2 \cdot21 =42$$
