Reference for a tangent squared sum identity

Jolley, Summation of Series, formula 445 is $$\sum_{k=0}^{n-1}\tan^2\left(\theta+{k\pi\over n}\right)=n^2\cot^2\left({n\pi\over2}+n\theta\right)+n(n-1)$$ Let $\displaystyle\theta={\pi\over2m+1}$, $n=2m+1$ and we almost have your sum; we have twice your sum, since the angles here go from just over zero to just under $\pi$, while in your sum they go from just over zero to just under $\pi/2$, and $\tan^2\theta=\tan^2(\pi-\theta)$.

Jolley's reference is to page 73 of S L Loney, Plane Trigonometry, Cambridge University Press, 1900. This book is best known from its part in Ramanujan's early education.


In fact, this type of formula is related to binomial coefficients. I give a proof of the general case I found in my post Tan binomial formulas from a set S and its k-subset