On line integrals of $\frac{xdy-ydx}{x^2 +y^2}$ There are a few questions on MSE about integrals of the form $$\int_C \frac{xdy-ydx}{x^2 +y^2},$$ where $C$ is a smooth simple closed positively oriented curve; but none of them gave me a complete understanding of what's going on.
Basically, there are two cases depending on whether $C$ encloses the origin or not. Is there a general result saying that in the former case $C$ can be replaced with a homotopic closed curve and the value of the integral won't change (a particular case of this is proved here, I believe)? If so, does it follow from the well-known similar theorems from complex analysis? In the latter case (if $C$ does not enclose the origin) I guess one cannot replace $C$ with a homotopic path. Does it have anything to do with complex analysis residues? Is such integral always zero? 
(Note that I'm not familiar with winding numbers.)
 A: You can rewrite $I$ as a contour integral. Let $z = x + i y$, then
$$I = \int_{\mathcal C} \frac {x dy - y dx} {x^2 + y^2} =
\int_a^b \frac {\operatorname{Im}(\overline z z')} {|z|^2} dt =
\operatorname{Im} \int_a^b \frac {z'} z dt =
\operatorname{Im} \int_{\mathcal C} \frac {dz} z.$$
This holds whether or not the curve is closed. The imaginary part of the logarithm is $\arg z$.
In vector terms, this is the two-dimensional version of Gauss's law. Let $\mathbf r = (x, y), \mathbf n = (y', -x')$. If the region $D$ enclosed by the curve does not contain the origin, then
$$I = \int_a^b \frac {\mathbf r \cdot \mathbf n} {r^2} dt =
\int_{\mathcal C} \frac {\mathbf r \cdot \mathbf n} {r^2 |\mathbf r'|} ds =
\int_{\mathcal C} \frac {\mathbf r \cdot \hat {\mathbf n}} {r^2} ds =
\iint_D \nabla \cdot \frac {\mathbf r} {r^2} dS = 0,$$
because $\nabla \cdot (\mathbf r / r^2) = 0$. Otherwise, if $\mathcal C_\epsilon$ is a small circle around the origin, the sum of $I$ and the integral over $\mathcal C_\epsilon$ with consistent orientations is zero by the same argument, and $\mathbf r \cdot \mathbf n / r^2 = \epsilon^2/\epsilon^2$ on $\mathcal C_\epsilon$.
