The following result is apparently due to Laurent. If $$F_n(z)=\prod_{m=1}^{n-1}\prod_{l=1}^{n-1}(1-z^{ml}),$$ we can show that the series $$f(z)=-\sum_{n=2}^{\infty}\frac{F_n(z/n)}{\{(z/n)^n-1\}n^{n-1}}$$ is an analytic function when $z$ is not a root of any of the equations $z^n=n^n;$ and that the sum of the residues of $f(z)$ contained in the annulus with outer radius between $n-1$ and $n,$ and small inner radius, is equal to the number of prime numbers less than $n,$ i.e. if we call this contour $C_n,$ then
$$\frac{1}{2\pi i}\int_{C_n} f(z)dz=\pi(n).$$
At the moment, to me, this result just seems to fall out of the air, without much intuition as to why someone would be particularly interested, aside from a convenient integral result, as well as the actual completion of the proof being just a bit out of my reach so far.
Is someone able to provide some insight into the 'why' behind this, as well as a proof of the theorem?
Progress
As far as I understand it, since the roots of $z^n=n^n$ are $z=ne^{2k\pi i/n},~k=0,1,2,\dots,n-1,$ if you look at $F_n(z)=F_n(e^{2k\pi i/n})$ at one of these roots (a pole of $f(z)$) the idea is that if $n$ is composite then since $l$ and $m$ run over all positive integers less than $n,$ $1-z^{ml}$ has to vanish for some combination since $klm$ will have to be a multiple of $n.$ So $F_n(z)$ is in some way a natural choice that would kill off any residues except when $n$ is prime.
As for the remainder of the argument, for the case in which $n$ is a prime number and the residues aren't trivial, I'm unsure how to show they must sum to $\pi(n).$
The main problem appears to be dealing with $F_n(e^{2k\pi i/n})$. I am unable to see how this must cancel down with the denominator in such a way that the sum of the residues is $\pi(n).$
Anyone with more talent with residues would be greatly appreciated in showing how this thing works.
Let $$g_n(z) = \frac{\prod_{a=1}^{n-1} \prod_{b=1}^{n-1} (1-z^{ab})}{1-z^n}$$
If $n$ is composite then $n=ab$ so $g_n(z)$ is a polynomial and $\int_{|z|=r} g_n(z)dz=0$.
If $n=p$ is prime then $g_p(z)$ has simple poles at $e^{2i \pi l/ p}, l \in 1 \ldots p-1$ so that $$\frac{1}{2i\pi}\int_{|z|=2} g_p(z)dz= \sum_{l=1}^{p-1} \frac{\prod_{a=1}^{p-1} \prod_{b=1}^{p-1} (1-e^{2i \pi abl/p})}{-p (e^{2i \pi l /p})^{p-1}} = \sum_{l=1}^{p-1} \frac{e^{2i \pi l /p}}{-p}\prod_{a=1}^{p-1} \Phi_p(1)=\frac{-1}{-p} p^{p-1}$$
where $\Phi_p(x) = \prod_{c \ne 0 \bmod p} (x-e^{2i \pi c/p}) = \sum_{m=0}^{p-1} x^m$
Let $$G_n(z) = \frac{g_n(z/n)}{ n^{n-1}}, \qquad \frac{1}{2i\pi}\int_{|z|= r} G_n(z)dz = \cases{ 1 \text{ if } r > n \text{ and } n \text{ is prime} \\ 0 \text{ otherwise}}$$
And hence $$F(z)=\sum_{n=2}^\infty G_n(z)$$ converges to a meromorphic function satisfying $$\frac{1}{2i\pi}\int_{|z| = n+1/2} F(z)dz= \pi(n)$$