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.
An idea is to use a Bezout identity with the polynomials $1-x$ and $1+X+\cdots+X^{n-1}$ to express $1/(1-\zeta^k)$ as a polynomial of $\zeta^k$. $$n-(1+X+\cdots+X^{n-1}) = \sum_{k=1}^{n-1} (1-X^k) = (1-X)\sum_{k=1}^{n-1}\Big(\sum_{\ell=0}^{k-1}X^\ell\Big)$$ $$n-(1+X+\cdots+X^{n-1}) = (1-X)\sum_{\ell=0}^{n-2}(n-1-\ell)X^\ell.$$ Applying the equality to $\zeta^k$ for $1 \le k \le n$ yields $$n = (1-\zeta^k)\sum_{\ell=0}^{n-2}(n-1-\ell)\zeta^{k\ell}.$$ Hence $$\sum_{k=1}^{n-1} \frac{\zeta^{km}}{1-\zeta^k} = \frac{1}{n}\sum_{k=1}^{n-1}\zeta^{km}\sum_{\ell=0}^{n-2}(n-1-\ell)\zeta^{k\ell}.$$ $$\sum_{k=1}^{n-1} \frac{\zeta^{km}}{1-\zeta^k} = \frac{1}{n}\sum_{\ell=0}^{n-2}(n-1-\ell)\sum_{k=1}^{n-1}\zeta^{k(m+\ell)}.$$ But $$\sum_{k=1}^{n-1}\zeta^{k(m+\ell)} = \sum_{k=0}^{n-1}\zeta^{k(m+\ell)} - 1 = n 1_{[n \textrm{ divides } m+\ell]} - 1.$$ The only term for which $n$ divides $m+\ell$ is given by $\ell = n-m$. Hence $$\sum_{k=1}^{n-1} \frac{\zeta^{km}}{1-\zeta^k} = \frac{1}{n} \Big((m-1)n - \sum_{\ell=0}^{n-2}(n-1-\ell)\Big).$$ $$\sum_{k=1}^{n-1} \frac{\zeta^{km}}{1-\zeta^k} = \frac{1}{n} \Big((m-1)n - \frac{n(n-1)}{2}\Big) = (m-1) - \frac{n-1}{2}.$$