Definition: If $ f $ is holomorpic in $G$ and gamma $\gamma$ is $G$-homotophic to a point then gamma is G-contratible and if gamma is G-contractible then $ \int_\gamma f = 0 $.
By splitting the integral using partial fraction we get $$ \int_\gamma \frac {dz}{z^2 − 2z} = \frac12\int_\gamma \frac {dz}{z − 2}-\frac12\int_\gamma \frac {dz}{z} $$ Thus if we apply the definition mentioned above to the first integral on the right hand-side it will be equal to zero since $\frac 1{z-2}$ is holomorphic in $\Bbb C$ \ {2} and $ \gamma $ is $\Bbb C$ \ {2}-contractible.
However, and this is my question, by the same reasoning the second integral in the right hand-side should be zero too since $ \frac1z $ is holomorphic in $\Bbb C$ \ {0} and $ \gamma $ is $\Bbb C$-contratible (not sure), I know that it is evaluated to $-\pi i$ but what is it restricting the function for the definition to be applied in that integral?
If both $0$ and $2$ are in the interior of $\gamma$, by the residue theorem we have:
$$\begin{align} \int_\gamma \frac{{\rm d}z}{z^2 - 2z} &= 2\pi i\left({\rm Res}(f,0) + {\rm Res}(f,2)\right) \\ &= 2\pi i\left(\frac{1}{2\cdot 0 - 2} + \frac{1}{2\cdot 2 - 2}\right) \\ &= 2\pi i\left(-\frac{1}{2} + \frac{1}{2}\right) \\ &= 0 \end{align}$$
If $\gamma$ has $0$, but not $2$, in its interior, then $\gamma$ is $\Bbb C \setminus \{2\}$-contractible and since $1/(z-2)$ is holomorphic there, your first integral in the RHS will be zero, so the overall result will be $-\pi i$. On the other hand, if $\gamma$ has only $2$, and not $0$, in its interior, then your second integral on the RHS will be zero, because $\gamma$ is $\Bbb C\setminus \{0\}$-contractible and $1/z$ is holomorphic there, so the overall integral evaluates to $\pi i$.
If neither $0$ nor $2$ is in the interior of $\gamma$, the argument above goes for both integrals and all of it evaluates to zero.
Finally, if both point are in the interior of $\gamma$, the integral gives zero because the residues cancel each other, and this is not related to homotopy theory or.whatever - this is a particularity of that specific $f$. We've seen that at the beginning of the answer, I checked it with the residue theorem, even.
This covers all cases.