Write $\sin{x} = (e^{i x}-e^{-i x})/(2 i)$. Then consider the integral
$$PV \oint_{C_{\pm}} dx \frac{e^{\pm i z}}{z (z^2-2 z+2)} $$
where $C_{\pm}$ is a semicircular contour of radius $R$ in the upper/lower half plane with a semicircular detour into the upper/lower half plane of radius $\epsilon$. For $C_{+}$, we have
$$PV \oint_{C_{+}} dz \frac{e^{i z}}{z (z^2-2 z+2)} = \int_{-R}^{-\epsilon} dx \frac{e^{i x}}{x (x^2-2 x+2)}+ i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{e^{i \epsilon e^{i \phi}}}{\epsilon e^{i \phi} (\epsilon^2 e^{i 2 \phi} - 2 \epsilon e^{i \phi}+2)} \\+ \int_{\epsilon}^R dx \frac{e^{i x}}{x (x^2-2 x+2)}+ i R \int_0^{\pi} d\theta \, e^{i \theta} \frac{e^{i R e^{i \theta}}}{R e^{i \theta} (R^2 e^{i 2 \theta} - 2 R e^{i \theta}+2)} $$
For $C_-$, we have
$$PV \oint_{C_{-}} dz \frac{e^{-i z}}{z (z^2-2 z+2)} = \int_{-R}^{-\epsilon} dx \frac{e^{-i x}}{x (x^2-2 x+2)}+ i \epsilon \int_{-\pi}^0 d\phi \, e^{i \phi} \frac{e^{-i \epsilon e^{i \phi}}}{\epsilon e^{i \phi} (\epsilon^2 e^{i 2 \phi} - 2 \epsilon e^{i \phi}+2)} \\+ \int_{\epsilon}^R dx \frac{e^{-i x}}{x (x^2-2 x+2)}- i R \int_0^{\pi} d\theta \, e^{-i \theta} \frac{e^{-i R e^{-i \theta}}}{R e^{-i \theta} (R^2 e^{-i 2 \theta} - 2 R e^{-i \theta}+2)} $$
In both cases, we take the limits as $R \to \infty$ and $\epsilon \to 0$. Note that, in both cases, the respective fourth integrals have a magnitude bounded by
$$\frac{2}{R^2} \int_0^{\pi/2} d\theta \, e^{-R \sin{\theta}} \le \frac{2}{R^2} \int_0^{\pi/2} d\theta \, e^{-2 R \theta/\pi}\le \frac{\pi}{R^3}$$
The respective second integrals of $C_{\pm}$, on the other hand, become equal to $\mp i \frac{\pi}{2} $. Thus,
$$PV \oint_{C_{\pm}} dz \frac{e^{\pm i z}}{z (z^2-2 z+2)} = PV \int_{-\infty}^{\infty} dx \frac{e^{\pm i x}}{x (x^2-2 x+2)} \mp i \frac{\pi}{2}$$
On the other hand, the respective contour integrals are each equal to $\pm i 2 \pi$ times the sum of the residues of the poles inside their contours. (For $C_-$, there is a negative sign because the contour was traversed in a clockwise direction.) The poles of the denominator are at $z_{\pm}=1 \pm i$. Thus,
$$PV \int_{-\infty}^{\infty} dx \frac{e^{\pm i x}}{x (x^2-2 x+2)} \mp i \frac{\pi}{2} = \pm i 2 \pi \frac{e^{\pm i (1 \pm i)}}{(1 \pm i) (2) (\pm i)} $$
Taking the difference between the two results and dividing by $2 i$, we get that
$$\int_{-\infty}^{\infty} dx \frac{\sin{x}}{x (x^2-2 x+2)} = \frac{\pi}{2} \left (1+\frac{\sin{1}-\cos{1}}{e} \right ) $$
Note that we may drop the $PV$ because the difference between the integrals removes the pole at the origin.
You could also use the following contour.
$$\int_{-\infty}^0 \frac{2x^2-1}{x^4+1}\operatorname dx =\int_{0}^{+\infty} \frac{2x^2-1}{x^4+1}\operatorname dx $$
Has an analytic continuation as $$\int_{\Gamma} \frac{2z^2-1}{z^4+1}\operatorname dz $$ with 4 poles, but just on pole inside of the contour.
$$\operatorname*{res}_{z=e^{i\frac{\pi}{4}}} f(z) = \frac{3\sqrt{2}}{8} -i \frac{\sqrt{2}}{8} $$
I think you made a calculation error here (?)
Using $$\int_{\Gamma} \frac{2z^2-1}{z^4+1}\operatorname dz = \color{blue}{\int_{\Gamma_1}\frac{2z^2-1}{z^4+1}\operatorname dz} + \int_{\Gamma_2}\frac{2z^2-1}{z^4+1}\operatorname dz + {\color{red}{\int_{\Gamma_3}\frac{2z^2-1}{z^4+1}\operatorname dz}}$$
- Now $\color{blue}{\int_{\Gamma_1} \to 0}$ as $R\to +\infty$ which can be proven using the triangle inequality.
- Use $\Gamma_2 \leftrightarrow z(x) = x$ and $x:0\to R$
- Use $\color{red}{\Gamma_3 \leftrightarrow z(y) = iy}$ and $y: R \to 0$
Which finally results in (as $R \to +\infty$)
$$2\pi i \left(\frac{3\sqrt{2}}{8} -i \frac{\sqrt{2}}{8}\right) = \color{blue}{0}+\int_{0}^{+\infty}\frac{2x^2-1}{x^4+1}\operatorname dx + \color{red}{ i \int_{+\infty}^0\frac{-2y^2-1}{y^4+1}\operatorname dy}$$
Here you can read the real parts which results in:
$$\int_{0}^{+\infty}\frac{2x^2-1}{x^4+1}\operatorname dx = \frac{\pi\sqrt{2}}{4}$$
Best Answer
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?