$$\int_0^{\infty} \frac{x^2+1}{x^4+1}dx$$
What i've found are the singularities at: $e^{\pi/4+\pi/2n}$ for $n=0,1,2,3$. But i'm unsure how to calculate the integral since I don't want to include the singularity at $x_2=\frac{-1+i}{\sqrt{2}}$ since then I would be calculating the integral from negative to positive infinity.
My idea was to construct a contour $\gamma : x=ti$ where $R<t\leq0$ and $\lim_{R\rightarrow \infty}$. My reckoning was that since:
$$\int_{\gamma}\frac{x^2+1}{x^4+1}dx=i\int_R^0\frac{1-t^2}{t^4+1}dt$$
doesn't have any singularities along the positive real numberline, it is therefore bounded and thus:
$$i\int_R^0\frac{1-t^2}{t^4+1}dt\leq \Big| i\int_R^0\frac{1-t^2}{t^4+1}dt\Big|\leq\int_R^0\frac{|1-t^2|}{|t^4+1|}dt\leq\frac{|R^2|+1}{|R^4|-1}\rightarrow0 \text{ when } R\rightarrow \infty.$$
The answer would then be: $$\lim_{R\rightarrow \infty}\int_0^{R}\frac{x^2+1}{x^4+1}dx=2\pi iRes(f;e^{\pi/4})-\int_0^{\pi/2}f(x)dx-i\int_R^0f(x)dx=\frac{\pi}{2\sqrt{2}}.$$
But sadly I am mistaken, what is wrong?