Apologies if this is not mathematically very precise.
I have been trying to calculate the Fourier series of $e^{i q |m|}$, but I'm having trouble with the absolute value in the exponential. Without having a proof, I think this might be true, but I'm not sure. $$\sum_{m=-\infty}^\infty e^{i(q|m|-km)}=1+\sum_{m=1}^\infty\left(e^{i m(q-k)}+e^{i m(q+k)}\right) =1+\pi(\delta(q-k)+\delta(q+k))$$ Splitting up $e^{i q|m|}=\cos(qm) + i |\sin(qm)|$ the second term in the above formula would correspond to the cosine part, but it seems wrong that the sine part becomes just 1?
--------- EDIT -------
I now believe that the LHS equals just $\pi(\delta(q-k)+\delta(q+k))$ (I've done the sum from -5000 to 5000 and plotted the real and imaginary parts). I still don't know how to show this though.
--------- EDIT2 --------
Actually, it seems that there is also some part like $i\delta'(k-q)+i\delta'(k+q)$ or something similar.
We can make some progress by taking the real part, which is straightforward and then calculate the imaginary part via the Kramers-Kronig relations. The latter requires the function in question to be analytic in the UHP and vanish as $|k|\to\infty$.
This is why we'll consider the complex conjugate instead $$\chi(k)=\sum_{m=-\infty}^\infty e^{i(km-q|m|)}.$$ I'm not entirely sure if the function is analytic. If it isn't, that might explain the discrepancy of this calculation to the actual solution.
The real part is $$\Re[\chi(k)]=1+\sum_{m=1}^\infty\left[\cos((q-k)m)+\cos((q+k)m)\right] =\pi\left[\delta(k-q)+\delta(k+q)\right],$$ such that the imaginary part evaluates to $$\Im[\chi(k)]=-\frac1\pi\mathcal P\int_{-\infty}^\infty\frac{\Re[\chi(k')]}{k'-k}\,dk' =\frac{1}{k-q}+\frac{1}{k+q}.$$
However, this answer is not quite right, as can be seen from the numerical solution. The actual answer should be $$\Im[\chi(k)]=\frac{1}{k-q}-\frac{1}{k+q},$$ the crucial difference being the minus sign, which is probably related to the absolute value being nonanalytical at 0.
Another way to write the solution is $$\sum_{m=-\infty}^\infty e^{ikam-ik_0a|m|} =\frac ia\left(\frac 1{k-k_0+i\varepsilon}-\frac 1{k+k_0-i\varepsilon}\right)$$ (understood in the usual sense that you have to take the limit $\varepsilon\to0^+$ in the end).