I would like to calculate an integral $$\oint_{\Gamma_L} f(z) dz$$ where $f(z)$ has infinitely many isolated poles, say, something like $1/{\sin (z)}$, and where $\Gamma_L$ is a curve that can be measured with some length scale $L$, so that as $L\to\infty$, the curve $\Gamma_L$ encloses more or the poles without missing any. For example, $\Gamma_L$ could be a circle of radius $L$, or a square of side length $L$. It goes without saying that $$\oint_{\Gamma_L} f(z) dz=\sum_{z_k \in \text{int}(\Gamma_L)}\text{Res}[f,z_k]$$ where $\text{int}(\Gamma_L)$ is the interior of $\Gamma_L$. If this integral can be evaluated another way, we can use it to find a closed-form expression for the sum, which is the goal in this problem. In particular, we want to take the limit $L\to\infty$ so that the sum runs over all poles.
If $f(z)$ had only finitely many poles, this would be simple - the integral could be calculated with the residue at infinity. However, the standard trick doesn't work here because the transform $z\to\frac{1}{w}$ makes the pole of $-\frac{1}{w^2}f(\frac{1}{w})$ at $0$ non-isolated.
Is there a way we can do this besides evaluating the integral directly? Is there any generalization of the residue at infinity that can be used to treat cases like this with poles that go off to infinity?