I want to evaluate (for integer $n,p$) $$ L_p = \sum_{m=1}^{n-1} \ln \left( 4 \sin^2 \frac{m \pi }{n}\right) e^{- 2\pi i p m /n} $$ and I have got two tools $$ \sum_{k=1}^{\infty} \frac{\cos kx}{k} = - \frac{1}{2} \ln \left(4 \sin ^2 \frac{x}{2}\right) $$ and $$ \sum_{k=1}^{n-1} r^{k} \cos kx = \frac{1 - r \cos x - r^{n} \cos (nx) + r^{n+1} \cos (nx -x)}{r^2 + 1 - 2 r \cos x} -1 $$ both of which are formulas tabulated in Gradshteyn, and I've individually verified them. (I couldn't derive the first myself, but second was easy to prove.)
Plugging in $L_p$, we get $$ L_p = \sum_{m=1}^{n-1} \left[-2 \sum_{k=1}^{\infty} \frac{\cos \left( k \cdot \frac{2 m \pi}{n}\right)}{k}\right] e^{- 2\pi i p m/n} $$ and exchanging the sum (as I understand can always be done according to this question), this becomes $$ L_p\; = -2\sum_{k=1}^{\infty} \frac{1}{k} \cdot \left[ \sum_{m=1}^{n-1} e^{-2 \pi i p m/n} \cdot \cos \left( m \cdot \frac{2\pi k}{n}\right)\right] $$ Setting $r = e^{-2 \pi i p/n}$, $x= 2\pi k/n$ and using above formula, the inner sum becomes $-1$. which means $$ L_p = 2 \sum_{k=1}^{\infty} \frac{1}{k} $$ which is of course divergent, but the left side was finite because $m=0$ never occurs in the sum.
What is going wrong, and how can I get $L_p$?