I want to calculate $\displaystyle I=\int_0^\infty\frac{x^2+3}{x^4+1}\;dx$ using contour integration.
I've obtained the correct answer of $I=\sqrt{2}\pi$ below, but I would appreciate if someone could verify my proof.
Let $\displaystyle f(z) = \frac{z^2+3}{z^4+1}$; and let $C$ be the semicircle with boundary diameter on the real line (say from $-R$ to $R$) in the upper half plane. Now, $f(z)$ has four simple poles at $z = \pm i^{\frac{1}{2}}, \pm i^{\frac{3}{2}}$. The two poles at $z = i^{\frac{1}{2}}, i^{\frac{3}{2}}$ lie on the upper half plane, and the sum of the residues of $f$ at these poles is $-\sqrt{2}i$.
So $$\displaystyle \oint_C f(z)\,dz=\int_{-R}^{R} f(z) \, dz +\int_{\text{Arc}} f(z)\, {dz} $$
So by the Residue theorem $$-i\sqrt{2}\cdot 2i\pi=\int_{-R}^{R} f(z) \, dz +\int_{\text{Arc}} f(z)\, {dz} $$
Thus $$2\sqrt{2}\pi=\int_{-R}^{R} f(z) \, dz +\int_{\text{Arc}} f(z)\, {dz} $$
I tried to show that the arc integral goes to $0$ as follows
$$\bigg|\int_{\text{Arc}} f(z)\, {dz} \bigg| \le \int_{\text{Arc}} |f(z)|\, {dz} \le \frac{R^2-3}{R^4-1} \cdot \pi R \to 0, ~\text{as} ~ R \to \infty $$
Because $|z|^4=\left|z^4\right| = \left|z^4+1-1\right| \le \left|z^4+1\right|+1 $
So $\displaystyle |{z^4+1}| \le |z|^4-1 = R^4-1 $, similarly
$|z|^2 = |z^2+3-3| \le |z^2+3|+3 \implies |z^2+3|\le |z|^2-3 = R^2-3 $
And the length of the arc is $\pi R$ combining altogether we get
$$\displaystyle \bigg|\int_{\text{arc}}\frac{z^2+3}{z^4+1} \,d{z}\bigg| \le \frac{(R^2-3)\cdot \pi R }{R^4-1}$$
Which goes to zero as $R \to \infty$. So the arc integral goes to $0$ as $R \to 0$.
Therefore $\displaystyle \int_{-\infty}^{\infty} \frac{z^2+3}{z^4+1}\,{dz} = 2\sqrt{2}\pi $ so that $I = \sqrt{2}\pi$ since the integrand is even.
Is this correct?