Let $G$ be open in $\mathbb{C}$ and $f:G\rightarrow \mathbb{C}$ be an analytic function.
Let's denote $\deg(f,z)$ to mean the multiplicity of a zero $z$ of $f$, and $Z(f)$ to mean the set of zeros of $f$.
Let $\gamma:[0,1]\rightarrow \mathbb{C}$ be a closed rectifiable curve which does not pass through zeros of $f$ and $\operatorname{Wnd}(\gamma,z)=0$ for all $z\in \mathbb{C}\setminus G$.
If $f$ has finitely many zeros in $G$, then $$\frac{1}{2\pi i} \int_\gamma \frac{f'(z)}{f(z)} dz = \sum_{z\in Z(f)} \deg(f,z) \operatorname{Wnd}(\gamma, z).$$ It's easy to prove this.
However, I'm curious whether the above equality holds in general.
So let's assume that $f$ has infinitely many zeros in $G$.
Since the set $\{z\in G:\operatorname{Wnd}(\gamma,z)\neq 0\}$ is relatively compact in $G$, $f$ has only finitely many zeros in $G$ whose winding numbers are nonzero. Hence, the term $\sum_{z\in Z(f)} \deg(f,z)\operatorname{Wnd}(\gamma,z)$ is well-defined.
So to prove the equality above, it suffices to prove the following statement:
Let $g:G\rightarrow \mathbb{C}$ be an anlytic function and $\gamma$ be a closed rectifiable curve in $G$ which does not pass through zeros of $g$ and $Wnd(\gamma,z)=0$ for all $z\in\mathbb{C}\setminus G$.
If any zero $z$ of $g$ satisfies $Wnd(\gamma,z)=0$, then $\int_\gamma \frac{g(z)}{g'(z)}dz= 0$
How do I prove this? If this is false, what would be a counterexample?
Yes, it holds in general. If you let $G_\epsilon$ be the open subset of $G$ which consists of the points $z$ with $|1/z|<\epsilon$ and $\textrm{dist}(z,\partial G) > \epsilon$, then for $\epsilon > 0$ sufficiently small, $\gamma \subset G_\epsilon$, and $f$ has finitely many zeros in $G_\epsilon$ because it is compactly contained in $G$. In order to apply the result about functions with finitely many zeros, you just have to check that the winding number of $\gamma$ about points in the complement of $G_\epsilon$ is still zero, which is straightforward since every point in the complement of $G_\epsilon$ can be connected to a point in the complement of $G$ (possibly $\infty$) without passing through $\gamma$.