Trig sum: $\tan ^21^\circ+\tan ^22^\circ+\cdots+\tan^2 89^\circ = \text{?}$

From Sum of tangent functions where arguments are in specific arithmetic series,

$$\tan180x=\frac{\binom{180}1t-\binom{180}3t^3+\cdots+\binom{180}{177}t^{177}-\binom{180}{179}t^{179}}{1-\binom{180}2t^2+\cdots-\binom{180}{178}t^{178}+\binom{180}{180}t^{180}}$$ where $t=\tan x$

If we set $\tan180x=0,180x=180^\circ r$ where $r$ is any integer

$\implies x=r^\circ$ where $0\le r<180$

So, the roots of $\binom{180}1t-\binom{180}3t^3+\cdots+\binom{180}{177}t^{177}-\binom{180}{179}t^{179}=0$ $\iff\binom{180}{179}t^{179}-\binom{180}{177}t^{177}+\cdots+\binom{180}3t^3-\binom{180}1t=0$ are $\tan r^\circ$ where $0\le r<180,r\ne90$ ($r=90$ corresponds to the denominator $=\infty$)

So, the roots of $\binom{180}{179}t^{178}-\binom{180}{177}t^{176}+\cdots+\binom{180}3t^2-\binom{180}1=0$ are $\tan r^\circ$ where $0<r<180,r\ne90$

So, the roots of $\binom{180}{179}u^{89}-\binom{180}{177}u^{88}+\cdots+\binom{180}3u-\binom{180}1=0$ are $\tan^2r^\circ$ where $0<r<90$

Using Vieta's formula, $\sum_{r=1}^{89}\tan^2r^\circ=\dfrac{\binom{180}{177}}{\binom{180}{179}}$


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} $$