Exponential sums and Partial fractions Let $e(x):=e^{2 \pi i x}$.  For integers $j$ and $k \geq 2$, is there a closed formula for
$$
\sum_{\ell=1}^{k-1} \frac{e\left(\frac{j \ell}{k}\right)}{1-e\left(\frac{\ell}{k}\right)}?
$$
For certain $k$ that I checked this appears to be $j-\frac{k+1}{2}$ for $1 \leq j \leq k$.  This feels like a partial fraction decomposition, but I'm not sure how to go in the other direction to get the original function.
 A: The sum can be written as:
$$\sum_{\ell=1}^{k-1} \frac{z_\ell^{j}}{1-z_\ell}$$ where $z_\ell =e(\ell/k)=e(1/k)^{\ell}.$
The $z_{\ell}$ are the roots of $1+z+z^2+\dots+z^{k-1}=0.$ We can show that for $i=1,\dots,k-1$ $$\sum_{\ell} z_\ell^i=-1.\tag{1}$$
Now, $$\begin{align}\frac{z_\ell^j}{1-z_\ell}&=\frac{z_\ell^j-1}{1-z_\ell}+\frac{1}{1-z_\ell}\\
&=-\left(1+z_\ell+z_\ell^2+\dots+z_\ell^{j-1}\right)+\frac{1}{1-z_\ell}\end{align}$$
And $$\sum_{\ell=1}^{k-1} \left(1+z_\ell+z_\ell^2+\dots+z_\ell^{j-1}\right)=(k-1)-(j-1)=k-j\tag{2}$$ for $1\leq j\leq k.$
(2) Is true because the $1$ terms contribute $k-1,$ and the terms $z_\ell^i$ contribute $-1$ for $i=1,\dots,j-1$ by (1).
Also, if $p(z)=1+z+\cdots +x^{k-1}$ then $$\frac{p'(z)}{p(z)}=\sum_{\ell=1}^{k-1} \frac{1}{z-z_\ell}$$
Then $$\sum_{\ell=1}^{k-1}\frac{1}{1-z_\ell}=\frac{p'(1)}{p(1)}=\frac{1+2+\dots+(k-1)}{k}=\frac{k-1}{2}.$$
Which was your conjecture.

The formula for $\frac{p'(z)}{p(z)}$ works for any polynomial of degree $m$ with roots $r_1,\dots,r_m:$ $$\frac{p'(z)}{p(z)}=\sum_{i=1}^{m}\frac{1}{z-r_i}$$
This can be seen because the integrals are equal, or by writing $p(z)=(z-r_1)\cdots(z-r_m)$ and taking the derivative using the product rule.
This is a very special case of partial fractions.
