Deciding convergence/divergence of $\sum_{m \geq 1} \frac{1}{m^3} \sum\limits_{\substack{k=1\\(m,k) = 1}}^m k \sin\left(\frac{2\pi k n}{m}\right)$ Let $n$ be a positive integer. I am attempting to determine whether the series
$$
\sum_{m \geq 1} \frac{1}{m^3} \sum_{\substack{k=1\\(m,k) = 1}}^m k \sin\left(\frac{2\pi k n}{m}\right)
$$
converges or diverges. I've tried the (admittedly naive) bound $|k\sin\left(\frac{2\pi kn}{m}\right)| < k$, but this doesn't help:
$$
\sum_{m \geq 1} \frac{1}{m^3} \sum_{\substack{k=1\\(m,k) = 1}}^m k \sin\left(\frac{2\pi k n}{m}\right) < \sum_{m \geq 1} \frac{1}{m^3} \sum_{\substack{k=1\\(m,k) = 1}}^m k \left|\sin\left(\frac{2\pi k n}{m}\right)\right| < \sum_{m\geq 1}\frac{1}{m^3} m\sum_{\substack{k=1\\(m,k) = 1}}^m 1 = \sum_{m\geq 1}\frac{\varphi(m)}{m^2} = \infty,
$$
where $\varphi$ is the totient function. I've also try leveraging the fact that
$$
\sum_{\substack{k=1\\(m,k) = 1}}^m \sin\left(\frac{2\pi kn}{m}\right) = 0,
$$
but that too led to a dead end. Is there an obvious trick to determine whether this series converges or diverges?
 A: This series diverges.
Assuming $n>0$ fixed, let $$a_m=\sum_{\substack{1\leqslant k\leqslant m\\(k,m)=1}}k\sin\frac{2nk\pi}{m},\quad b_m=\sum_{1\leqslant k\leqslant m}k\sin\frac{2nk\pi}{m}.$$ If $m\nmid n$ and $\omega=e^{2n\pi\mathrm{i}/m}$, then $(\omega-1)\sum_{k=1}^m k\omega^k=m\omega^{m+1}-\sum_{k=1}^{m}\omega^k=m\omega$, hence $$b_m=\frac{1}{2\mathrm{i}}\sum_{k=1}^{m}k(\omega^k-\omega^{-k})=\frac{m}{2\mathrm{i}}\left(\frac{\omega}{\omega-1}-\frac{\omega^{-1}}{\omega^{-1}-1}\right)=-\frac{m}{2}\cot\frac{n\pi}{m},$$ and trivially $b_m=0$ if $m\mid n$.
Further, for $d\mid m$, we have $$a_{m,d}:=\sum_{\substack{1\leqslant k\leqslant m\\(k,m)=\color{red}{d}}}k\sin\frac{2nk\pi}{m}=\sum_{\substack{1\leqslant k\leqslant m/d\\(k,m/d)=1}}kd\sin\frac{2nkd\pi}{m}=da_{m/d}$$ and clearly $$b_m=\sum_{d\mid m}a_{m,d}=\sum_{d\mid m}da_{m/d}=\sum_{d\mid m}(m/d)a_d\implies\frac{b_m}{m}=\sum_{d\mid m}\frac{a_d}{d}.$$
By Möbius inversion, and our computation of $b_m$ above, $$\frac{a_m}{m}=\sum_{d\mid m}\mu\Big(\frac{m}{d}\Big)\frac{b_d}{d}=-\frac12\sum_{d\mid m,\ d\nmid n}\mu\Big(\frac{m}{d}\Big)\cot\frac{n\pi}{d}=\frac12(A_m-B_m),\\A_m:=\sum_{d\mid m,\ d\nmid n}\mu\Big(\frac{m}{d}\Big)\left(\frac{d}{n\pi}-\cot\frac{n\pi}{d}\right),\\B_m:=\frac{1}{n\pi}\sum_{d\mid m,\ d\nmid n}d\mu(m/d)=\frac{1}{n\pi}\left(\varphi(m)-\sum_{d\mid(m,n)}d\mu(m/d)\right).$$
To estimate $A_m$, denote $f(x)=(1/x)-\cot x$; then $f(x)=\mathcal{O}(x)$ as $x\to 0$. Now we split $A_m$ into a sum over $d<2n$, which is $\mathcal{O}(1)$ as $m\to\infty$, and a sum over $d\geqslant 2n$, which is at most $$\sum_{d=2n}^{m}f\left(\frac{n\pi}{d}\right)=\mathcal{O}\left(\sum_{d=1}^{m}\frac1d\right)=\mathcal{O}(\log m)$$ in absolute value; hence, $A_m=\mathcal{O}(\log m)$ as $m\to\infty$, and $\sum_{m=1}^\infty A_m/m^2$ converges.
But $\sum_{m=1}^\infty B_m/m^2$ diverges, since $\sum_{m=1}^\infty\varphi(m)/m^2$ does, and $\sum_{d\mid(m,n)}d\mu(m/d)=\mathcal{O}(1)$.
