Confusion in Cauchy Integral Formula I am trying to calculate a simple contour integral in three different ways and am getting three different results.
$$\int_{\vert z \vert = 2} \frac{1}{z^2+1}dz$$
Method $1$:
Write $\frac{1}{z^2 + 1} = \frac{1}{(z+i)(z-i)} = \frac{1/(z+i)}{z-i}$. Since $i \in B_2(0)$, we can apply the Cauchy Integral Formula to get
$$\int_{\vert z \vert = 2} \frac{1}{z^2+1}dz = \int_{\vert z \vert = 2} \frac{1/(z+i)}{(z-i)}dz = 2\pi i f(i)$$
where $f(z) = \frac{1}{z+i}$. Hence, the integral evaluates to $\pi$ since $f(i) = \frac{1}{2i}$.
Method $2$:
This is almost identical to the above. Write $\frac{1}{z^2 + 1} = \frac{1}{(z+i)(z-i)} = \frac{1/(z-i)}{z-(-i)}$. Since $-i \in B_2(0)$, we can apply the Cauchy Integral Formula to get
$$\int_{\vert z \vert = 2} \frac{1}{z^2+1}dz = \int_{\vert z \vert = 2} \frac{1/(z-i)}{(z-(-i))}dz = 2\pi i g(-i)$$
where $g(z) = \frac{1}{z-i}$. Hence, the integral evaluates to $-\pi$ since $g(-i) = -\frac{1}{2i}$.
Method $3$:
Using partial fractions, $\frac{1}{z^2+1} = \frac{1}{(z+i)(z-i)} = -\frac{1}{2i}\left(\frac{1}{z+i} - \frac{1}{z-i}\right)$. So,
$$\int_{\vert z \vert = 2} \frac{1}{z^2+1}dz = -\frac{1}{2i} \left(\int_{\vert z \vert = 2} \frac{1}{z+i}dz - \int_{\vert z \vert = 2}\frac{1}{z-i}dz\right) = 0$$
since both integrals are $2\pi i$.
Which of these three methods is correct and why are the other two wrong? (By symmetry I feel like the third one is correct, though I also think it may be that the first two are correct but somehow represent integrating in opposite directions along the contour.)

The first two are wrong. You are forgetting an important hypothesis is Cauchy's Integral Formula. The functions $f(z)=\frac   1{z+i}$ and $f(z)=\frac   1{z-i}$ are not analytic in any region containing $\{z: |z| \leq 2\}$, so the formula is not applicable for these functions.
