I recently learned summing a trigonometric series where the $i^{th}$ term is $\cos(i\theta)$ where the angles are in arithmetic progression. The idea is to multiply the sum $S$ by $\sin\theta$ and reduce it to a telescopic series.
The same process can be applied if the $i^{th}$ term is $\cos^2(i\theta)$ by using the half-angle identity.
But suppose, the $i^{th}$ term is $\frac{1}{1 + m\cdot \tan^2(i\theta)}$. We get the previous series (whose sum is known) if $m = 1$
How can we compute the sum if $m \neq 1$ $$ S = \sum_{i=0}^{n-1}\frac{1}{1 + m\cdot \tan^2(i\theta)} $$
I tried differentiating $S$ and tried multiplying it with trigonometric functions but to no avail. I went through various questions posted in this site in the Trigonometric series and Summation tags but still made no progress.
$$S_m = \sum_{i=0}^{n-1}\frac{1}{1 + m\, \tan^2(i\theta)}\qquad \text{with} \qquad m>1$$ Using Euler representation of the tangent function $$S_m=-\frac n{m-1}+\frac{\sqrt{m}}{(m-1) \log \left(e^{2 i \theta }\right)}\, \color{red}{\large \text{A}} $$
where $$ \color{red}{\large \text{A}}=\psi _{e^{2 i \theta }}^{(0)}\left(n-\frac{\log \left(1-\frac{2}{\sqrt{m}+1}\right)}{\log \left(e^{2 i \theta }\right)}\right)-\psi _{e^{2 i \theta }}^{(0)}\left(n-\frac{\log \left(1+\frac{2}{\sqrt{m}-1}\right)}{\log \left(e^{2 i \theta }\right)}\right)+$$ $$\psi _{e^{2 i \theta }}^{(0)}\left(-\frac{\log \left(1+\frac{2}{\sqrt{m}-1}\right)}{\log \left(e^{2 i \theta }\right)}\right)-\psi _{e^{2 i \theta }}^{(0)}\left(-\frac{\log \left(1-\frac{2}{\sqrt{m}+1}\right)}{\log \left(e^{2 i \theta }\right)}\right)$$ where appear the q-digamma function.