Let $e(t)$ denote $\exp\{2\pi i t\}$. For integers $m$ and $j$, why is it true that $\sum_{k=1}^{m-1} e(jk/m) = 0$ if $m$ does not divide $j$; and $m$ if $m$ does divide $j$?
I tried the case $m=j=2$ but this gives $\sum_{k=1}^{m-1} e(jk/m) =e(1) = \cos(2\pi) + i\sin(2\pi) = 1 \not= 2 =m$. Is there something wrong?
I will consider the sum starting at $k=0$ (and not $k=1$ as written in the question).
If $j/m$ is an integer, then $e^{2\pi i k j / m}=1$ for all $k$, so the sum is $m$.
If $j/m$ is not an integer, then $e^{2\pi i j / m}\ne1$, and we have $$ \sum_{k=0}^{m-1}e^{2\pi i j k / m} =\sum_{k=0}^{m-1}(e^{2\pi i j / m})^k =\frac{1-(e^{2\pi i j / m })^m}{1-e^{2\pi i j / m }} =\frac{1-e^{2\pi i j }}{1-e^{2\pi i j / m }} =\frac{0}{1-e^{2\pi i j / m }}=0 $$