# Riemann sum estimate of Cauchy residue formula

Let $e(k) = \exp \left(\frac{2 \pi i k}{N}\right)$ be a root of unity.

I wanted to numerically verify the Cauchy residue formula in Mathematica.
$$\lim_{N \to \infty}\frac{1}{N}\sum_{k=0}^{N-1} \frac{e(k) }{e(k) - a} = \frac{1}{2\pi i} \oint_{|z|=1} \frac{dz}{z - a} = \mathbf{1}( |a| < 1)$$

This computes the winding number of the curve $|z|=1$ (counter-clockwise) around $a \in \mathbb{C}$.

Can this Riemann sum be evaluated exactly? I would like to know the leading-order correction of the Riemann sum to the integral .

-

Denote the lhs as $f_N(a)$. It can be regarded as a rational function of complex variable $a$. It's straightforward to check that $f_N(a e(i))=f_N(a)$, $i=0,\ldots,N-1$. Which means that $f_N$ is a rational function of $a^N$. From the other hand $\lim_{a\to\infty}f_N(a)=0\;$. This leaves the only possibility $$f_N(a)=\frac c{\prod_{i=0}^{N-1}(e(i)-a)}=\frac c{1-a^N}.$$ Plugging $a=0$ gives $c=1$ so $f_N(a)=\frac1{1-a^N}$. Thus the difference between the sum and the integral is $f_N(a)-1=\frac {a^N}{1-a^N}$.