definition of winding number, have doubt in definition.
Solution 1:
It is a non-trivial fact from topology that given any curve $\gamma:[0, 1]\rightarrow\mathbb{C}\setminus\{a\}$ we can find a continuous polar coordinate expression about $a$ such that $$\gamma(t) = a + r(t)\cdot e^{i\theta(t)}$$ where $\theta$ and $r$ are continuous themselves (if the curve is differentiable, so are $r$ and $\theta$). Moreover $\theta$ and $r$ are uniquely defined up to multiples of $2\pi$ which is a freedom in the choice of the starting angle. The main consequence of the above is that the natural definition of the winding number should be $$\mathrm{Wnd}(a,\ \gamma) = \frac{\theta(1) - \theta(0)}{2\pi}$$ i.e. the total continuous angular change of the curve divided by $2\pi$. It should not be hard to convince yourself that this is always an integer for closed curves and represents the number of times $\gamma$ "winds" about $a$. It remains to relate this intuitive definition to our integral definition and the key component is the logarithm $$\log(z) = \ln|z| + i\theta(z)$$ where the imaginary component of the logarithm is essentially an angle tracking function, provided that we can make it vary continuous. (The logarithm is inherently discontinuous along some branch cut, so one remedy is the above continuous polar expression. Another is to piece together multiple integrals to make the argument vary continuously.) So we have \begin{align}\oint_\gamma \frac{1}{z-a} dz &= \int_0^1 \frac{r'(t)e^{i\theta(t)} + i\theta'(t)r(t)e^{i\theta(t)}}{r(t)e^{i\theta(t)}} dt\\ &=\int_0^1 \frac{r'(t)}{r(t)} + i\theta'(t) dt\\ &=\log(r(1))-\log(r(0)) + i\left[\theta(1) - \theta(0)\right]\end{align} Since the curve is closed, it follows that $r(1) = r(0)$ so the expression evaluates to $$i\left[\theta(1) - \theta(0)\right]= 2\pi i\cdot\mathrm{Wnd}(a,\ \gamma)$$ which is the justification for the integral definition.
Solution 2:
I am going to explain what happens for $a=0$, in general if you work at some other $a$, you just need to replace $f(z)$ by $f(z+a)$ and you reduce to the below case.
It is easy to see that if $C$ is the circle $C(t) =e^{it} \,;\, 0 \leq t \leq 2 \pi$ then
$$\int_{C} \frac{1}{z} = 2 \pi i$$
Now, if you combine this result with the fact that $\frac{1}{z}$ is analytic on $\mathbb{C} \backslash \{ 0 \} $ you get the desired result.
You could replace $f(z)= \frac{1}{z}$ by any function which is analytic on $\mathbb{C} \backslash \{ 0 \} $, and with the property that $\int_{C} f(z) = 2 \pi i$, where $C$ is the above circle. Anyhow, if you look for such function, and you write it's Laurent Series, you will get $f(z)=\frac{1}{z} +$ analytic, and the analytic part is irrelevant for the integration.
P.S. I think that one can prove that, up to addition by an entire function, the only meromorphic function $f(z)$ which has the property that $\int_\gamma f(z-a) =$winding number at $a$ is $f(z) =\frac{1}{z}$.
Solution 3:
About the easy-to-see part in @N.S.'s answer on this same page. On the unit circle $1/z = \cos(t)-i\sin(t)$, integrating which over $0\leq t\leq 2\pi$ is clearly zero. The confusion that might arise is the implied integrand $\mathrm{d}z$.
$$\int_{C} \frac{1}{z} \; \mathrm{d}z$$
When integrating in $\mathbb{R}^2$, $\mathrm{d}x$ is a function that reflects how the $x$ variable varies as we move along the curve. The $\mathrm{d}z$ is analogous, except that $z$ is complex, which may be non-trivial to visualise.
A nice way to see what happens is to imagine approximating the contour integral using rectangles by analogy with the Riemann integral: they stand with their bases along the curve in the complex plane, and the height is the function you're integrating. Now, when integrating in $\mathbb{R}^2$, the base of the rectangle has the length of that side, but in $\mathbb{C}$, it is the complex number corresponding to its base. If the rectangle's corners on the curve are complex numbers $a$ and $b$, then the contribution to the sum will be $\text{height} \cdot (b-a)$ (cf. $\text{height} \cdot |b-a|$ if we were integrating along a curve as in $\mathbb{R}^2$).
But then we might as well use two rectangles for each such $a$ and $b$: one with the base parallel to the real axis, and the other with the base parallel to the imaginary axis. Going around the unit circle in the usual way, we see that the bases of the real-based rectangles behave exactly as $(-\sin(t))$, while the bases of the imaginary-based rectangles behave exactly as $i\cos(t)$, if we plot them over $t$ in our parameterisation. Now, scale that by $\text{Re}\{1/z\} = \cos(t)$, and, just from a sketch we can see that it is going to give $i\pi$. Similarly, $\text{Im}\{1/z\}$ scaled by this gives another $i\pi$.
About going from the unit circle integration to any curve.
Continuing to think about what happens when we start with a circle and deform it slightly, it becomes clear that we need to think about this problem in polar coordinates indeed.
(This is intended to be about intuition, so it's a bit loose.)
Consider what happens when we integrate $1/z\;\text{d}z$ along a small part of some curve that happens to be heading in precisely radial direction. If this is at a point $a + ib$, then $1/z$ is a scaled conjugate of $\text{d}z$, therefore the contribution to the integral will be purely real. If the curve was going in the orthogonal direction (i.e. the $\theta$ direction), then we multiply $\text{d}z$ by $i$ (i.e. rotate by 90°), and that contribution will be purely imaginary. This means we can treat these two (radial and azimuthal) directions separately.
Now, approximating the curve by purely radial little steps and purely azimuthal little steps, consider a sector. Or, in fact, consider concentric circles. Everywhere along a circle of radius $r$, the magnitude of $1/z$ is $1/r$. Therefore, as we increase the circle, the value of the integral does not change: the path length increases proportionally to $r$, while the magnitude of the integrand decreases proportionally to $r$. Therefore, if we approximated a curve using sectors, we may move the part of the curve in any sector without affecting its contribution to the integral. As such, this integral may be used to measure the angle that someone walking along the curve moves through with respect to the origin, factoring out all the other details of the path they take.