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 .