Why is $\frac{1}{2\pi i}\int_{\gamma}\frac{f'(z)}{f(z)}dz$ an integer?

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.