Complex series evaluation I am evaluating a complex series of the form:
\begin{eqnarray}
S=\lim_{M\to \infty}\frac{1}{M}\sum_{m=0}^{M-1}\frac{e^{ic}e^{-i2\pi m/M}}{1-e^{ic}e^{-i2\pi m/M}}
\end{eqnarray}
where $M\in \mathbb{Z}^{+}$ and $c$ is a constant. I don't know how to evaluate this series. I have tried reducing it to:
\begin{eqnarray}
S=-1+\lim_{M\to \infty} + \frac{1}{M}\sum_{m=0}^{M-1}\frac{1}{1-e^{ic}e^{-i2\pi m/M}}
\end{eqnarray}
When using Mathematica, it says it cannot evaluate due to possible singularities at the denominator, happening when $e^{ic}e^{-i2\pi m/M}=1$. I have also tried to make:
\begin{eqnarray}
\frac{1}{1-e^{i( c - 2\pi m/M )}}=\sum_{k=0}^{\infty}\left(e^{i( c - 2\pi m/M )}\right)^{k}
\end{eqnarray}
and then change the $m$ summation with the $k$ (evaluating the sum in $m$ first); however this seems to lead nowhere. Is there any good way to work out such limiting case of the series? I also looked at some digamma function expansions, but I don't know if this is of any help here. Also, since eventually $M\to \infty$, I considered shifting the summation indices to make $\sum_{-\infty}^{+\infty}$, which could maybe be related to a complex analytic function due to residues theorem or similar? Any help is appreciated thanks!
 A: This is just a problem of converting a limit to an integral: (Riemann sum)
$$S=\lim_{M\to \infty}\frac{1}{M}\sum_{m=0}^{M-1}\frac{e^{ic}e^{-i2\pi m/M}}{1-e^{ic}e^{-i2\pi m/M}}$$
$$=\int_0^1\dfrac{e^{ic-2\pi ix}}{1-e^{ic-2\pi ix}}dx$$
$$=-\dfrac{\mathrm{i}\ln\left(\left|\mathrm{e}^{\mathrm{i}c-2\mathrm{i}{\pi}x}-1\right|\right)}{2{\pi}}\Biggr|_{0}^{1}$$
$$=\dfrac{\mathrm{i}\ln\left(\left|\mathrm{e}^{\mathrm{i}c}-1\right|\right)}{2{\pi}}
-\dfrac{\mathrm{i}\ln\left(\left|\mathrm{e}^{\mathrm{i}c-2\mathrm{i}{\pi}}-1\right|\right)}{2{\pi}}= 0$$
however since the sum diverges, this is not true.
A: If I am not wrong, one can express the integral as:
\begin{eqnarray}
S=\frac{1}{4\pi i}\int_{0}^{2\pi}d\theta\frac{e^{-i(\theta-c)/2}}{\sin\left((\theta-c)/2\right)}
\end{eqnarray}
and then use $e^{-i(\theta-c)/2}=\cos( (\theta-c)/2 ) - i\sin((\theta-c)/2)$, with $c\in\mathbb{R}$.Then one integral is trivial and the other is the integral of the $cot( (\theta-c)/2 )$, which is supposed to be well defined. Using that substitution I find:
\begin{eqnarray}
S=-\frac{1}{2} +\frac{1}{4\pi i}\int_{0}^{2\pi}d\theta\cot((\theta-c)/2)=-\frac{1}{2} + \frac{1}{2\pi i}\int_{-c/2}^{\pi - c/2}dx\cot(x)\\
=-\frac{1}{2} + \frac{1}{2\pi i}\left[\log\left(|sin(\pi-c/2)|\right)-\log\left(|sin(-c/2)|\right)\right]=-\frac{1}{2}
\end{eqnarray}
If would be nice if someone could approve this solution, I think it is an interesting series.
