Identity regarding roots of unity Let $\zeta$ be a primitive $n$-th root of unity and $m \in \{0,1,\dots,n-1\}$. I am interested in finding the value of the following expression:
$$\sum_{k=1}^{n-1}\frac{\zeta^{mk}}{1-\zeta^k}.$$
This has come up in a context where it should be a rational number (in fact it seems like it will be of the form $\frac{r}{2}$ where $r \in \mathbb Z$). For example for $m=0$ I can get the values $\frac{n-1}{2}$ by letting $f(x) = \frac{x^n-1}{x-1}$ and noticing that the desired sum equals $\frac{f'(1)}{f(1)}$. However I am not able to find such a "trick" when $m$ is nonzero.

Note that with $\zeta$ being primitive the powers $\zeta^k$ with  $0\le
k\le n-1$ just permute the powers of $\zeta = \exp(2\pi i/n)$ so we  may
take that as our root. Next introduce
$$f(z) = \frac{z^m}{1-z} \frac{n/z}{z^n-1}.$$
We have for $1\le k\le n-1$
$$\mathrm{Res}(f(z); z = \zeta^k)
= \frac{\zeta^{km}}{1-\zeta^k}.$$
Residues sum to zero and with $m\lt n$ the residue at infinity is
zero. Hence the desired sum must be minus the residue at $z=1.$ We
write (the minus from the residue cancels the minus from the $1/(1-z)$
term):
$$- \mathrm{Res}(f(z); z=1) =
\mathrm{Res}\left(\frac{z^m}{z-1}
\frac{n/z}{(z-1)(1+z+z^2+\cdots+z^{n-1})}; z=1\right)
\\ = \left. \left( \frac{nz^{m-1}}{1+z+z^2+\cdots+z^{n-1}}
\right)' \right|_{z=1}
\\ = \left. \left( \frac{n(m-1)z^{m-2}}{1+z+z^2+\cdots+z^{n-1}}
- \frac{nz^{m-1} (1+2z+3z^2+\cdots+(n-1)z^{n-2})}
{(1+z+z^2+\cdots+z^{n-1})^2}
\right)\right|_{z=1}
\\ = \frac{n(m-1)}{n} - \frac{n \frac{1}{2} (n-1) n}{n^2}
\\ = m-1 - \frac{1}{2} (n-1).$$
