compute the integral Compute $$\int_{|z|=2}\frac{dz}{z^2+1}$$
the circle to be oriented positively 
I know in this problem we have to use Cauchy Integral formula, but I don't know how to do it yet. Can you please show me how ?
 A: Using partial fraction expansion, we can write
$$\frac{1}{z^2+1}=\frac{1}{2i}\left(\frac{1}{z-i}-\frac{1}{z+i}\right)$$
Therefore,
$$\begin{align}
\oint_{|z|=2}\frac{1}{z^2+1}dz&=\frac{1}{2i}\left(\oint_{|z|=2}\frac{1}{z-i}dz-\oint_{|z|=2}\frac{1}{z+i}dz\right)\\\\
&=\frac{1}{2i} \left(2\pi i \text{Res}\left(\frac{1}{z-i},z=i\right) -2\pi i \text{Res}\left(\frac{1}{z+i},z=-i\right)     \right)\\\\
&= \pi\times (1)-\pi\times (1)\\\\
&=0
\end{align}$$

NOTE:
It is interesting to show the direct calculation of the contour integral of interest.  Here, we let $z=2e^{it}$ with $dz=i2e^{it}dt$.  Thus, 
$$\begin{align}
\oint_{|z|=2}\frac{1}{z^2+1}dz&=\int_0^{2\pi}\frac{i2e^{it}}{4e^{i2t}+1}dt\\\\
&=\int_0^{2\pi}\frac{i2e^{it}(4e^{-i2t}+1)}{17+8\cos 2t}dt\\\\
&=i2\int_0^{2\pi}\frac{4e^{-it}+e^{it}}{17+8\cos 2t}dt\\\\
&=i2\int_0^{2\pi}\frac{5 \cos t}{17+8\cos 2t}dt\\\\
&=i2\int_0^{2\pi}\frac{5 \cos t}{25-16\sin^2 t}dt\\\\
&=i\int_0^{2\pi} \cos t \left(\frac{1}{5+4\sin t}+\frac{1}{5-4\sin t}\right)dt\\\\
&=i\left.\left(\frac14\log(5+4\sin t)-\frac14\log (5-4\sin t)\right)\right|_{0}^{2\pi}\\\\
&=0
\end{align}$$
As one can easily see, contour integration using the residue theorem can greatly facilitate carrying out integrals.
A: $$I=\int_{|z|=2}\frac{1}{z^2+1}dz = -2i\int_{|z|=2}\left(\frac{1}{z+i}-\frac{1}{z-i}\right)=-2i\int_{|z|=2}\frac{1}{z+i}dz+2i\int_{|z|=2}\frac{1}{z-i}dz.$$
Using the Cauchy integral formula then gives
$$I=-2i(2\pi if(i))+2i(2\pi if(-i)),$$ where $f(z)=1$. Hence,
$$I=4\pi-4\pi=0.$$
You could also directly use residues as in Dr. MV's answer.
