Use Cauchy's theorem to prove that $\int_{C}{\frac{z^2+2z-5}{(z^2+4)(z^{2}+2z+2)}dz}=0$ Let $C$ the circle $|z|=r$, show that $$\lim_{r\to\infty}\int_{C}{\frac{z^2+2z-5}{(z^2+4)(z^{2}+2z+2)}dz}=0$$
My approach: Note that $|z^2+2z-5|\leq r^2+2r+5$ and $|(z^2+4)(z^{2}+2z+2)|=|(z^2+4)||(z^{2}+2z+2)|\leq (r^2+4)(r^2+2r+2)$. So, $$\left|\frac{z^2+2z-5}{(z^2+4)(z^{2}+2z+2)}\right|\leq \frac{r^2+2r+5}{(r^2+4)(r^2+2r+2)}\to 0$$
When $r\to\infty$. 
However, how apply  Cauchy's theorem in this case; This theorem is usually formulated for closed paths as follows, let $U$ be an open subset of $\mathbb{C}$ which is simply connected, let $f : U → \mathbb{C}$ be a holomorphic function, and let $\gamma$ be a rectifiable path in $U$ whose start point is equal to its end point. Then $$\int_{\gamma}{f(z)dz}=0$$ I know that, If $f(z)$ is analytic in a bounded region, limited by closed simple curve $C_1,C_2,\ldots, C_n$ and on this curves, then $$\int_{C}{f(z)dz}=\int_{C_{1}}{f(z)dz}+\int_{C_{2}}{f(z)dz}+\ldots+\int_{C_{n}}{f(z)dz}$$ And in this case the singularities points are $\{-1-i,-1+i,-2i,2i\}$, so we can construc curves around this points, can give me any hint, thanks!
 A: The first argument can be easily made to work, we have for $r>10$ the estimations:
$$
\begin{aligned}
|z^2+2z-5| & \le |z^2|+2|z|+5
\\
&\le(1+2+5)|z|^2\ ,
\\
|z^2+4| & \ge |z^2|-4
\\
&\ge|z|^2-\frac 4{100}|z^2|=\left(1-\frac 4{100}\right)|z^2|\ ,
\\
|z^2+2z+2| & \ge |z^2|-2|z|-2
\\
&\ge|z|^2-\frac 2{10}|z^2|-\frac 2{100}|z^2|
=\left(1-\frac 2{10}-\frac 2{100}\right)|z^2|\ ,
\end{aligned}
$$
so the whole integrand can be controlled, bounded by a constant times $|z^{-2}|=r^{-2}$. This times the length of the contour, $2\pi r$, tends to zero.

To use the residues, it is enough to observe that the sum of the residues (inside of a circle around zero containing all for poles) is zero. So the integral is zero. (Also after considering the $2\pi i$ from the formula.)
Let us compute the residues.
To makes things easy (to type), i will use a computer algebra system, here sage:
sage: var( 'z' );
sage: F = (z^2+2*z-5)/(z^2+4)/(z^2+2*z+2)

sage: F.partial_fraction()
1/10*(7*z + 17)/(z^2 + 4) - 7/10*(z + 3)/(z^2 + 2*z + 2)

sage: poles = F.denominator().roots(multiplicities=False)
sage: poles
[-I - 1, I - 1, -2*I, 2*I]

sage: for pole in poles:
....:     print "Residue of F in %6s is %15s" % ( pole, F.residue(z==pole) )
....:     
Residue of F in -I - 1 is  -7/10*I - 7/20
Residue of F in  I - 1 is   7/10*I - 7/20
Residue of F in   -2*I is  17/40*I + 7/20
Residue of F in    2*I is -17/40*I + 7/20

From the above, it is clear that the sum of the residues is zero, the terms in $\pm 7/20$, in $\pm 7i/10$, and in $\pm 17i/10$ cancel together.
We use the above partial fraction decomposition to make the computations easy. The residue of 
$$
\frac{7 \, z + 17}{10 \, {\left(z^{2} + 4\right)}}
=
\frac 1{z-2i}\cdot\frac{7 \, z + 17}{10 \, {\left(z+2i\right)}}
$$
in $2i$ is the value of the function
$$
\frac{7 \, z + 17}{10 \, {\left(z+2i\right)}}
$$
in $2i$, we have only to substitute $z=2i$ and compute
$\frac{14i+17}{10\cdot(2i+2i)}$ explicitly. We get the above value in the line Residue of F in    2*I is -17/40*I + 7/20.
The residue in $-2i$ is the complex conjugate. (Since the fraction is invariated by the complex conjugation.) Similarly we compute the residues for the other poles and the other fraction in the partial fraction decomposition...
A: Can't you re-write the integral using partial fractions as the following 
$$\frac{1}{10} \left[ \int \frac{7z+17}{z^2 + 4} dz  + \int \frac{7(z+3)}{z^2 + 2z +2}  dz  \right].$$
Both denominators can be expressed as $z^2 + 4 = (z+2i)(z-2i)$ and similarly $z^2 + 2z + 2 = (z-z_1) (z-z_2)$ where $z_1 = -1+i$ and $z_2 = -1-i$. Then follow the instructions from the wiki article.
A: I hope the idea of residue at infinity would delight you.
For a complex function $f(z)$, its residue at infinity is defined as
$$\text{Res}_{z=\infty}f(z)=-\text{Res}_{z=0}\frac1{z^2}f(\frac1z)$$
A useful relation is
$$\text{Res}_{\infty}f(z)+\sum_{\text{all poles}} \text{Res}\, f(z)=0$$ for $f(z)$ with finitely many poles.
Since your integrand has finitely many poles, the formula applies.
Let $f(z)$ be your integrand.
With a little algebra, we get
$$\text{Res}_\infty f(z)=-\text{Res}_{z=0}\frac{1+2z-5z^2}{(1+4z^2)(1+2z+2z^2)}\color{RED}{=0}$$
Immediately, $$\sum_{\text{all poles}} \text{Res}\, f(z)\color{RED}{=0} $$ as desired.
Please also note that, due to Cauchy’s theorem, $$\oint_{|z|=\infty}f(z)dz=\sum_{\text{all poles}}\text{Res}f(z)=\color{red}{0}$$ and your result follows. Plus, thus the tedious calculation of residues can be avoided.
