How to rigorously justify "picking up half a residue"? Often in contour integrals, we integrate around a singularity by putting a small semicircular indent $\theta \rightarrow z_0 + re^{i\theta}$, $0 \leq \theta \leq \pi$ around the singularity at $z_0$.
Then one claims that the integral "picks up half a residue" as $r \rightarrow 0$, so we compute the residue, divide by two, and multiply by $2\pi i$ to get the limiting value of the integral over the small semicircle.
I don't see how to justify this rigorously. I tried adapted the proof of the residue theorem, which involves expanding Taylor series, but this crucially relies on the fact that the path is closed.
I also tried using seeing if the values of the function on the semicircle all tend to the same value as the semicircle shrinks to zero. But I'm not sure if this is even true, since we don't really have nice behavior of the function at $z_0$.
So my question is this. Under what circumstances can we claim that the integral over a small semicircle centered at a pole $z_0$ is $\pi i$ times the residue at $z_0$, and how do we prove this?

This works when the function has a simple pole at $z_0$. It doesn't work for higher-order poles or essential singularities. In fact, you can say something stronger: if a function has a simple pole at a point, then the limiting value of its integral on an angle-$\theta$ arc around that point is always $i\theta$ times the residue of the function at that point.
You can see this by noticing that:


*

*It works when your integrand is $\frac{1}{z-z_0}$, and therefore whenever it's $\frac{a}{z-z_0}$.

*If $f$ is holomorphic at $z_0$, adding $f$ to your integrand won't change whether or not it works (because $f$ is locally bounded, and your circular arc is small).

*It doesn't work for $\frac{1}{(z-z_0)^n}$, where $n>1$.


The combination of the first two bullet points means it works whenever your integrand has a simple pole. The last bullet point means you have no reason to expect it to work otherwise (though it's possible that you might occasionally get lucky).
If you're looking for detailed proofs of all these facts in some complex analysis textbook, I think the key phrase to look for in the index or table of contents is "indented contours."
