Let $f(z)$ be a rational function on $\mathbb{C}$. If the residues of $f$ at $z=0$ and $z=\infty$ are both $0$, is it true that $\oint_{\gamma} f(z)\mathrm dz=0$ ($\gamma$ is a closed curve in $\mathbb{C}$)? Thanks.

-

Unless I'm misunderstanding your question, $f(z) = \frac{1}{z-1}-\frac{1}{z+1}$ is a counterexample.
In fact, to have $\oint_\gamma f(z)\ dz =0$ for all closed contours $\gamma$ that don't pass through a pole of $f$, what you need is that the residues at all the poles of $f$ are 0. Since the sum of the residues at all the poles (including $\infty$) is always 0, it's necessary and sufficient that the residues at all the finite poles are 0.