Proving that an integral is a holomorphic function Let $U\in \mathbb C$. Let $f:U\to\mathbb C$ be analytic on $U$ and continuous on the boundary of $U$. I want to prove that, for each $a\in U$, and sufficiently small $r>0$, 
$$
g(w)=\frac{1}{2\pi i}\int_{|z-a|=r}\frac{zf'(z)}{f(z)-w}dz
$$
defines a holomorphic function.
My attempt: Assume for a moment that $f$ is injective (not actually valid). Using the substitution $x=f(z)$, we get
$$
g(w)=\frac{1}{2\pi i}\int_{|f^{-1}(x)-a|=r}\frac{f^{-1}(x)}{x-w}dx=f^{-1}(w)
$$
by Cauchy integration formula, since $f^{-1}$ is analytic (because $f'(z)\neq0$).
Is this valid? I feel something missing. For example, I have not addressed the condition "sufficiently small r". What's wrong?
 A: Let $n$ be the order of the zero of $f(z)-f(a)$ at $z=a$. 
$$f(z)- f(a)= f^{(n)}(a) (z-a)^n+O((z-a)^{n+1})$$
For $r$ small enough then $f(z)-f(a)-w, |z-a|=r$ doesn't vanish on $|w| < R= \frac12 |f^{(n)}(a)| r^n$ so that $$g(f(a)+w)=\frac{1}{2\pi i}\int_{|z-a|=r}\frac{zf'(z)}{f(z)-f(a)-w}dz$$ is analytic on $|w| < R$.
Iff $n=1$ then $g(w) = f^{-1}(w)$ (proving the latter is locally analytic). If $n=2$ then the substitution $u = f(z)$ in the integral transforms the simple loop $|z-a| = r$ into a double loop around $f(a)$. 
You can use the residue theorem to express $g(f(a)+w)$ in term of $f^{-1}$.
A: EDITED: 
More generally, let $\mu$ be a complex (finite) measure on a measurable space $X$, $\varphi$ a measurable function on $X$, and $V$ an open subset of $\mathbb C$ that does not intersect $\varphi(X)$.  Then
$$ g(z) = \int_X \frac{d\mu(x)}{\varphi(x) - z}$$
is analytic in $V$.  You can prove this using Morera's theorem.  
In the OP's case, $V = \mathbb C \backslash f(\Gamma_r)$ where $\Gamma_r$ is the circle $|z-a| = r$.  Note that for any $w \ne f(a)$, you can take $r$ small enough that $w \in V$.
