Is there any identity for $\sum_{k=1}^{n}\tan\left(\theta+\frac{k\pi}{\color{red} {2n+1}}\right)$? Is there any identity for $\sum_{k=1}^{n}\tan\left(\theta+\frac{k\pi}{\color{red} {2n+1}}\right)$ or $\sum_{k=1}^{n}\tan\left(\frac{k\pi}{\color{red} {2n+1}}\right)$ ?
I thought maybe wrongly that given:
$\sum_{k=1}^{n}\cot\left(\frac{k\pi}{\color{red} {2n+1}}\right)=\sum_{k=1}^{n}-\tan\left(\frac{\pi}{ {2}}+\frac{k\pi}{\color{red} {2n+1}}\right)$
and since $n \cot(nx)$ is the logarithmic derivative of $\sin(nx)$ and $\cot\left(x+\frac{\pi k}{n}\right)$ is the logarithmic derivative of $\sin\left(x+\frac{\pi k}{n}\right)$, I tried manipulating the identity:
$2^n \prod_{k=1}^n \sin\left(\frac{k\pi}{2n+1}\right)=\sqrt{2n+1}$
but I kept getting stuck.
The variation $\sum_{k=0}^{n-1}\tan\left(\theta+\frac{k\pi}{n}\right)=−n\cot\left(\frac{n\pi}{2}+n\theta\right)$ is seen to work quite nicely.
 A: Disclaimer: I thought this would turn out to be a routine, olympiad type exercise on manipulating roots of unity and so I started writing an answer but then I got stuck. Leaving it here for now if someone else/myself manage to fix it and will remove it before the bounty period ends.
Let $\theta = \dfrac{\pi}{2n+1}.$ Then,
$$i\tan\theta = \dfrac{e^{i\theta} - e^{-i\theta}}{e^{i\theta} + e^{-i\theta}} = 1 - \dfrac{1}{1+e^{2i\theta}},$$
so it suffices to find them sum:
$$\sum_{k=1}^n\dfrac{1}{1+e^{2ik\theta}}.$$
If we let $z_k = e^{2ik\theta}$, then the plan of attack is we find what unique, monic, degree $n$ polynomial have $z_1,z_2,\dots z_n$ as roots. If we could find a simple expression $f(z),$ then $f(z-1)$ has roots $1+z_k$'s and from there we can write a simple Vieta ratio to find the desired sum.
Note that $z_k = e^{2\pi i\tfrac{k}{2n+1}} = \rho^{k},$ where is a primitive root of unity of order $2n+1.$ This means that:
$$\dfrac{z^{2n+1}-1}{z-1} = \prod_{k=1}^n(z-\rho^k)\prod_{k=n+1}^{2n}(z-\rho^k)=f(z) \prod_{k=1}^n(z-\rho^{k+n}).$$
Some basic manipulation tells us:
$$\prod_{k=1}^n(z-\rho^{k+n}) = \prod_{k=1}^n(z-\rho^{2n+1-k})=\prod_{k=1}^n(z-\rho^{-k}) = \rho^{-n(n+1)/2}\prod_{k=1}^n\rho^{k}(z-\rho^{-k}) = $$
$$=\rho^{-n(n+1)/2}\cdot (-1)^n\prod_{k=1}^n(1-\rho^kz) = \rho^{-n(n+1)/2}\cdot (-z)^n\prod_{k=1}^n\left(\frac 1z-\rho^k\right) = $$
$$ \rho^{-n(n+1)/2}\cdot (-z)^n f\left(\frac 1z\right),$$
so we obtain:
$$z^nf(z)f\left(\frac{1}{z}\right) = \dfrac{z^{2n+1}-1}{z-1}\cdot\rho^{n(n+1)/2}\cdot (-1)^n.$$
