I want to evaluate the integral: $$\int_{-\infty}^{0}\frac{2x^2-1}{x^4+1}\,dx$$
using contour integration.
I re-wrote it as: $\displaystyle \int_{0}^{\infty}\frac{2x^2-1}{x^4+1}\,dx$. I am considering of integrating on a semicircle contour with center at the origin. I considered the function $\displaystyle f(z)=\frac{2z^2-1}{z^4+1}$ which has $4$ simple poles but only two of them lie on the upper half plane and included in the contour which are: $\displaystyle z_1=\frac{1+i}{\sqrt{2}}, \;\; z_2=\frac{-1+i}{\sqrt{2}}$.
The residue at $\displaystyle z_1$ equals $\displaystyle \mathfrak{Res}\left ( f; z_1 \right )=-\frac{2i-1}{2\sqrt{2}}$ while the residue at $z_2$ equals $\displaystyle -2\sqrt{2}i-2\sqrt{2}$. (if I have done the calculations right)
Now, I don't know how to continue. Should I find the residues at the other poles as well and the say $\displaystyle \oint_{C}f(z)=2\pi i \sum res$ where $C$ is the semicircle contour and then expand it? That is:
$$\oint_{C}f(z)\,dz=\int_{0}^{a} + \int_{{\rm arc}}$$
Then let $a \to +\infty$ then than arc integral would go to zero. But I don't know how to proceed.
I had dealt with this integral with residues converting it into a minus infinity to infinity integral but with contours I am having a bit of problem.
Therefore I'd like some help.