Contour Integral of $\int_0^{\infty} \frac{1}{x^4+1} dx $ - Missing a factor of 2 I'm supposed to evaluate:
$$ \int_0^{\infty} \frac{1}{x^4+1} dx $$
Consider $$ \oint \frac{1}{z^4+1} dz  = \oint \frac{1}{(z - \frac{1-i}{\sqrt 2})(z + \frac{1-i}{\sqrt 2})(z - \frac{1+i}{\sqrt 2})(z + \frac{1+i}{\sqrt 2})} dz$$
The poles are at $z = \pm \frac{1-i}{\sqrt 2} $ and $z = \pm \frac{1+i}{\sqrt 2} $.
Consider this contour:

Take the semi-circle to infinity, the integral along the chord goes to zero, and integral becomes:
$$\int_{-\infty}^{\infty} \frac{1}{x^4 +1} dx $$
Residue at $z=\frac{i-1}{\sqrt 2}$ is $\frac{i}{2\sqrt 2(i-1)}$. Residue at $z=\frac{1+i}{\sqrt 2}$ is $\frac{-i}{2 \sqrt 2 (i+1)}$. Sum of residue is $\frac{-i}{2\sqrt 2}$.
$$\int_{-\infty}^{\infty} \frac{1}{x^4 +1} dx   =  \pi i \times \frac{-i}{2\sqrt 2} = \frac{\pi}{2\sqrt 2} $$
$$\int_{0}^{\infty} \frac{1}{x^4 +1} = \frac{\pi}{4\sqrt 2} $$.
Using, wolframalpha, the answer is twice of mine. Wolframalpha is never wrong.

You can't use the contour you tried to use, because the real integral you want to compute is not on the contour. Instead you should use a semicircle with the diameter on the real axis. Then the poles are inside the contour, so their residues give you the factor of $2 \pi i$ you need to get the right answer.
