# A Problem with Residue Theorem

According to some reliable sources, the residue theorem can be stated as: the sum of residues of a function on the whole complex plane(including infinity) is zero.

Now consider $$f(x) = \frac{\csc(\pi/x)}{x^2}$$ which has singularities at $+1, -1, 0, \infty$.

By Laurent expansion, I found that the residue is $\frac{1}{\pi}$ for $1, -1$ and $0$, and the residue at infinity is $\frac{-1}{\pi}$.

Obviously, this contradicts the residue theorem.

What mistakes did I make?

The sum of all residues of a rational function on the extended complex plane (the Riemann sphere) is zero. But this is not a rational function. Also $0$ is not an isolated singularity; any neighbourhood of zero contains infinitely many other singularities, so there is no residue of $f$ definable at $z=0$.