Solution (source code)

= Solution

The complex <fundamental theorem of calculus> says that for a <holomorphic> <antiderivative> $F$ and a piecewise $C^1$ path $\gamma$ from $a$ to $b$, one has $\int_\gamma F'(z)dz=F(b)-F(a)$. The integral is therefore zero on a closed path; the <antiderivative> need only be defined on a neighborhood of that path, rather than on all its interior.

The assumptions make $F(z)=z/f(z)^n$ <holomorphic> near $\gamma$. Differentiate:
$$
F'(z)=\frac1{f(z)^n}-n\frac{zf'(z)}{f(z)^{n+1}}.
$$
Integrate this <derivative> around the closed path to obtain
$$
\boxed{\int_\gamma\frac{dz}{f(z)^n}=n\int_\gamma\frac{zf'(z)}{f(z)^{n+1}}dz.}
$$