How can one distinguish the interior and exterior of a contour on a Riemann sphere? Maybe this is a stupid question but I have been confused by it for a long time... 
By residue theorem one sees the contour integral
$$\oint \frac{dz}{z}=2\pi i\mathrm{Res}\left(\frac{1}{z},0\right)=2\pi i,$$
where the contour encircles the only singularity $z=0$. If the singularity instead does not lie inside the contour then
$$\oint \frac{dz}{z}=0.$$
But if we consider the Riemann sphere, any two contours can be deformed continuously to encircle the singularity. How can one distinguish these two cases? Or in another words, how can one distinguish the interior and exterior of a contour?
 A: First, you should know that on the sphere, the residue theorem as stated is not quite true. What is true is that the sum of the residues at all singularities is $0$. However, you have forgotten to check what happens at $\infty$. The residue at infinity is defined by 
$$\operatorname{Res}(f,\infty)= \operatorname{Res}\!\Bigg(\!\!-\frac{1}{z^2}f\bigg(\frac{1}{z}\bigg),0 \Bigg) $$
When you do this, you see that the example you give has a residue at $\infty$ as well. Now taking into consideration the orientations of the boundary curves, you'll see that one integral evaluates to $2\pi i$ and the other to $-2\pi i$, consistent with the theorem. In other words, once you have stated the residue theorem correctly, the orientation of the curve still works fine to determine the inside and outside.
A: For $\phi$ a chart from the unit disk to $p\in X$ a Riemann surface and $f$ meromorphic $X\to \Bbb{C}$ the residue  $$Res(f(\phi(s)),0)=\frac1{2i\pi}\int_{|s|=\epsilon} f(\phi(s))ds$$ depends on $\phi$, it is chart dependent, not suited to Riemann surfaces.
Nevertheless, for $z$ the natural chart of $\Bbb{C\subset P^1(C)}$ then $f(z)dz$ is a meromorphic 1-form and we have again some kind of residue $$Res(f(z)dz,p)=\frac1{2i\pi}\int_{|s|=\epsilon} f(\phi(s))d\phi(s)$$ 
which this time is chart independent.
Let $\gamma\subset \Bbb{C\subset P^1(C)}$ be a simple closed-curve enclosing all the poles of $f$. Due to the simple connectedness of the Riemann sphere $\gamma$ is homotopic to a point so that $$\int_\gamma f(z)dz=0$$
On the other hand the same homotopy stuff gives $$\int_\gamma f(z)dz=2i\pi\sum_j Res(f(z)dz,p_j)$$
Taking $\phi(s)=1/s$ the chart at $\infty$ then $$Res(f(z)dz,\infty)=\frac1{2i\pi}\int_{|s|=\epsilon}f(1/s)d(1/s)$$ $$=-\frac1{2i\pi}\int_{|s|=\epsilon}f(1/s)s^{-2}ds=Res(-f(1/s)s^{-2},0)$$
