Proof (argument principle)

First equality

Use the integral form of the winding number to see $$ \begin{align*} I(f\circ γ; 0) = \frac{1}{2πi} \oint_{f\circ γ} \frac{\d w}{w} = \frac{1}{2πi} \int_{a}^{b} \frac{f'(γ(t)) \,γ'(t)}{f(γ(t))} \d t = \frac{1}{2πi} \oint_{γ} \frac{f'(z)}{f(z)} \d z. \end{align*} $$

Second equality

Simple poles of $\frac{f'}{f}$ of residue $k$ $\iff$ zero of $f$ with order $k$ or pole of $f$ with order $-k$

$f'/f$ is holomorphic on $U$ away from zeros and poles of $f$.

If $f$ is a zero of order $k$ at $z=a$, write $$ \begin{align*} f(z) = (z-a)^{k} g(z) \end{align*} $$ where $g$ is holomorphic at $a$ and $g(a)\neq 0$. Differentiating, $$ \begin{align*} &f'(z) = k(z-a)^{k-1} g(z) + (z-a)^k g'(z) \\ \implies & \frac{f'(z)}{f(z)} = \frac{k}{z-a} + \frac{g'(z)}{g(z)}. \end{align*} $$ $g(a)\neq 0$ so $g'/g$ is holomorphic at $a$. Therefore $f'/f$ has a simple pole at $z=a$ of residue $k$.

Similar computation for poles, with $k$ replaced by $-k$.

Applying the residue theorem

$f'/f$ is meromorphic on $U\cup γ$ with no poles on $γ$. Moreover all points in $U$ have a winding number of 1 since $γ$ bounds $U$. Therefore by the residue theorem, $$ \begin{align*} \frac{1}{2πi} \int_{γ} \frac{f'}{f} \d z ={}& \sum_{\text{poles $a_i$ of $f'/f$ in $U$}} \Res_{z=a_i} \frac{f'(z)}{f(z)} \end{align*} $$ which counts the orders of zeros minus orders of poles.