Why is $\frac{1}{2\pi i}\int_{\gamma}\frac{f'(z)}{f(z)}dz$ an integer? Let $f$ be holomorphic in an open $\Omega \subset \mathbb{C}$ and $\gamma$ a closed curve in $\text{int}(\Omega)$, along which $f$ is never zero. 
Are these hypotheses enough to claim $\frac{1}{2\pi i}\int_{\gamma}\frac{f'(z)}{f(z)}dz$ is an integer? If not, what are the necessary and sufficient conditions for that?
I can prove that's an integer for some particular cases, for example when $\Omega$ is convex and  $\gamma$ is a circle. But I've seen people claming this in many other contexts, like when $\Omega$ is an annulus around $0$ and $\gamma $ is an arbitrary curve inside it. This isn't obvious to me at all.
Thanks!
 A: One must require that $\gamma$ doesn't pass through any zeros of $f$. If $\gamma$ passes through a zero of $f$, then the integral doesn't exist as a Lebesgue integral, but under mild assumptions on the regularity of $\gamma$ one can still interpret it as a principal value integral. However, in that case, the principal value need not be an integer.
If $\gamma$ doesn't pass through any zero of $f$, then noting that $\frac{f'}{f}$ is the derivative of any local branch of $\log f$ one deduces the assertion. Let's suppose that $\gamma \colon [0,1] \to \Omega \setminus f^{-1}(0)$, and set $z_0 = \gamma(0)$. Using the local existence of branches of $\log f$ on $\Omega \setminus f^{-1}(0)$, one finds that
$$f(\gamma(t)) = f(z_0)\cdot \exp \biggl( \int_{\gamma\lvert_{[0,t]}} \frac{f'(z)}{f(z)}\,dz\biggl)$$
for all $t\in [0,1]$. Since $\gamma(1) = \gamma(0)$ it follows that
$$\exp\biggl( \int_{\gamma} \frac{f'(z)}{f(z)}\,dz\biggr) = 1,$$
which is equivalent to the assertion.
A: Yes, because that's the Logarithmic Derivative of $f$ and if it's meromorphic, it will have residue $\pm n$, either from a zero of order $n$, or from a pole of order $n$ inside your contour.
Choosing any small circle $w=\rho\exp(i\theta)$ around the enclosed singularity or zero and using the principal branch of the logarithm,
$$
\frac{1}{2\pi i}\int_\gamma \frac{dw}{w}=\frac{\pm n}{2\pi i}\int_{-\pi}^\pi \frac{i\rho\exp(i\theta)d\theta}{\rho\exp(i\theta)}=\frac{\pm n}{2\pi i}\int_{-\pi}^\pi i d\theta=\frac{\pm n\cdot 2\pi i}{2\pi i}=\pm n
$$
(With my apologies of course to Daniel Fischer's much more complete answer)
And btw, that's the winding number of $f$ as Martin R says in his comment.
