Using the function $$ f(z)=\frac{n/z}{z^n-1}\left(\frac{z-1}{z+1}\right)^2\tag{1} $$ and residue theorem $$ \sum_{k=0}^{n-1}\tan^2\left(\frac{k\pi}{n}\right)=n^2-n\tag{2} $$ can be found according to this post: Prove that $\sum\limits_{k=0}^{n-1}\dfrac{1}{\cos^2\frac{\pi k}{n}}=n^2$ for odd $n$
So I was wondering if it is possible to use the residue method to find an identity for $$ \sum_{k=0}^{n-1}\tan^2\left(\frac{k\pi y}{n}\right)\tag{3} $$ $0\leq y \leq 1$
and how? or alternative method if not.