I've split the integral around $z_1 = 1 - i$ and $z_2 = 1+ i$ using the contours $C_1$ and $C_2$:
$ \int_{|C|=2} g(z) dz = \int_{C_1} g(z) dz + \int_{C_2} g(z) dz$
In this case, $g(z)$ for $C_1$ is $\displaystyle \frac{\frac{1}{z-z_1}}{z-z_2}$ and $g(z)$ for $C_2$ is $\displaystyle \frac{\frac{1}{z-z_2}}{z-z_1}$. Using Cauchy's Thm I get $\displaystyle \frac{1}{z_2 - z_1}$ for the first one and $\displaystyle \frac{1}{z_1 - z_2}$ for the second. But evaluating
$\displaystyle \int_{|C|=2} g(z) dz = 2\pi i \left(\frac{1}{z_2 - z_1} + \frac{1}{z_1 - z_2} \right) = 0$
I'm not interested in other methods, just this particular version where you split the contour $C$ into $C_1$ and $C_2$ My issue with this answer is that it doesn't make sense. When evaluating an integral like $\displaystyle \int_{\infty}^{-\infty} \frac{dx}{x^2 + 2x + 2}$ you must let $\displaystyle g(z) = \frac{1}{z^2 + 2z + 2}$ and then integrate over the contour $C$. I would've thought that the answer would be give me $\pi$
Take $R>2$ and let $\gamma_R$ be the upper semicircle of $|z|=R$ and the real interval $[-R, R]$, take $\gamma_R$ positively oriented:
Since $z=1+i$ is the only singularity inside $\gamma_R$ for all $R>2$,then $$ \int_{\gamma_R} \frac{dz}{z^2+2z+2} = 2\pi i \left(\frac{1}{z-(1+i)}\right)=2\pi i \left(\frac{1}{2i}\right) = \pi \ \ \forall \ R>2 $$ On the other side if $\Gamma_R=Re^{it}$ for $t\in[0,\pi]$, ($\Gamma_R$ is just the upper semicircle) then $\gamma_R=\Gamma_R \cup [-R,R]$, thus $$ \int_{\gamma_R} \frac{dz}{z^2+2z+2} = \int_{\Gamma_R}\frac{dz}{z^2+2z+2} + \int_{-R}^R \frac{dx}{x^2+2x+2} $$ Since the integral over $\Gamma_R$ vanishes when $R \to \infty$ then $$ \pi = \lim_{R \to \infty }\int_{\gamma_R} \frac{dz}{z^2+2z+2} = \lim_{R \to \infty }\int_{\Gamma_R}\frac{dz}{z^2+2z+2} + \lim_{R \to \infty }\int_{-R}^R \frac{dx}{x^2+2x+2} = \int_{-\infty}^\infty \frac{dx}{x^2+2x+2} $$