TITLE: Trig sum: $\tan ^21^\circ+\tan ^22^\circ+\cdots+\tan^2 89^\circ = \text{?}$
QUESTION [34 upvotes]: As the title suggests, I'm trying to find the sum $$\tan^21^\circ+\tan^2 2^\circ+\cdots+\tan^2 89^\circ$$
I'm looking for a solution that doesn't involve complex numbers, or any other advanced branch in maths. The solution can involve techniques such as induction, telecoping, etc, but preferably only ideas from precalculus, e.g. trig identities, polynomials, etc.
EDIT: I know that the sum is a rational number.

REPLY [20 votes]: The function
$$
\frac{180/z}{z^{180}-1}
$$
has residue $1$ at each root of $z^{180}-1$ $\left(\text{i.e. }e^{k\pi i/90}\text{ for }k=0\dots179\right)$ and residue $-180$ at $z=0$.
On $|z|=1$,
$$
\tan(\theta/2)=-i\frac{z-1}{z+1}
$$
Integrating
$$
f(z)=-\left(\frac{z-1}{z+1}\right)^2\frac{180/z}{z^{180}-1}
$$
around a large circle is $0$ since the integrand is approximately $|z|^{-181}$. Thus, the sum of residues is
$$
2\sum_{k=0}^{89}\tan^2\left(\frac{k\pi}{180}\right)+\operatorname*{Res}_{z=0}f(z)+\operatorname*{Res}_{z=-1}f(z)=0
$$
Since $\operatorname*{Res}\limits_{z=0}f(z)=180$ and $\operatorname*{Res}
\limits_{z=-1}f(z)=-\frac{32402}{3}$, we get
$$
\begin{align}
\sum_{k=0}^{89}\tan^2\left(\frac{k\pi}{180}\right)
&=\frac12\left(\frac{32402}{3}-180\right)\\
&=\frac{15931}{3}
\end{align}
$$

This same method also gives
$$
\sum_{k=0}^{89}\tan^4\left(\frac{k\pi}{180}\right)=\frac{524560037}{45}
$$
and
$$
\sum_{k=0}^{89}\tan^6\left(\frac{k\pi}{180}\right)=\frac{4855740968543}{135}
$$