Show that $\int^{\infty}_{-\infty}\frac{dx}{(x^2-4x+5)^2} = \frac{\pi}{2}$ using residue theory I'm trying to evaluate some complex integrals using residue theory. I've read a number of articles with different examples here on Stack Exchange, but I'm still really lost and could use some help.

Show that $\int^{\infty}_{-\infty}\frac{dx}{(x^2-4x+5)^2} = \frac{\pi}{2}$.

First, I found the poles of the function as $2-i$ and $2+i$. Both of these poles are of order $2$. I am also considering my region as the semicircle of radius $R$ in the upper half-plane with the line segment between $x=−R$ and $x=R$ on the real axis. So I know that I need to evaulate
$$\int_{\Gamma}f(z)dz = 2\pi iRes(f,2+i) + 2\pi iRes(f,2-i)$$
At this point, I'm really stuck on what to do from here. I tried evaluating the residues and was getting some really weird answers. My work was really messy and likely completely wrong, so hopefully it's OK if I don't reproduce it here. I'm not sure how to finish solving this.
Similarly, I'm having trouble with this integral:

$\int_{|z| = 1}z^3e^{1/z}\sin(\frac{1}{z}) dz$

I know that there is a pole at $z = 0$. So that means I need to evaluate
$$ \int_{|z| = 1}z^3e^{1/z}\sin(\frac{1}{z}) dz = 2\pi i Res(f,0)$$
Do I consider this pole of order $1$ or order $2$ and how do I find this residue?
 A: For the first problem, to compute the resides of $\frac1{(z^2-4x+5)^2}$, we evaluate the limits
$$\lim_{z\to (2\pm i)}\frac{d}{dz}\left(\frac{z-(2\pm i)}{(z^2-4x+5)^2}\right)$$
But only the pole at $z=2+i$ is in the upper half plane.  Can you finish now?
For the second problem, there is no pole at $z=0$.  Rather, the point $z=0$ is an essential singularity.  Expand both $e^{1/z}$ and $\sin(1/z)$ in Taylor series of powers of $1/z$ (the Laurent series) and use their Cauchy Product to determine the coefficient on the term $\frac1{z^4}$.  Can you wrap this up now?
A: Alright, so your curve is the semi-circle of radius $R$ in the upper half-plane, so here it is:

Since the poles are $2 \pm i$ (pink points in the pic), it only contains one of them, so the integral over your curve $\Gamma$ will simply be:
$\displaystyle\int_\Gamma f(z) \mathrm{d}z = 2\pi i \text{Res}(f, 2 + i)$.
Now, your curve $\Gamma$ can be split into $\gamma_1$ and $\gamma_2$, where $\gamma_1 = [-R, R]$, and $\gamma_2$ is the half-circle.
So $\displaystyle\int_\Gamma f(z)\mathrm{d}z = \displaystyle\int_{\gamma_1} f(z)\mathrm{d}z + \displaystyle\int_{\gamma_2} f(z)\mathrm{d}z = \displaystyle\int_{-R}^R f(x)\mathrm{d}x + \displaystyle\int_{\gamma_2} f(z)\mathrm{d}z$
So you want to know the integral over the real-axis, you can just isolate it:
$\displaystyle\int_{-R}^R f(x)\mathrm{d}x = \displaystyle\int_\Gamma f(z) \mathrm{d}z - \displaystyle\int_{\gamma_2} f(z) \mathrm{d}z = 2\pi i \text{Res}(f, 2 + i) - \displaystyle\int_{\gamma_2} f(z) \mathrm{d}z$.
So... all you have to do now is compute the integral over $\gamma_2$ (hint: it's going to be zero, can you see why?)
