Compute the integral $\int_{0}^{\infty} \frac{(1 + x + x^2)}{(1+x^4)} dx $ with a residue on suitable contour. I believe that I could try to compute the same integral with limits from $-\infty$ to $\infty$ using residue on a half circle and then let the radius tend off to infinity, and once I have that value I should be able to take half of that integral. However, my colleagues have told me that I am wrong. I am not sure how to approach this, with residues, otherwise.

We will use the contour $\gamma$ avoiding the positive real axis,

Change variables $x\mapsto x^{1/4}$ to get
$$
\int_0^\infty\frac{1+x+x^2}{1+x^4}\,\mathrm{d}x=\frac14\int_0^\infty\frac{x^{-3/4}+x^{-1/2}+x^{-1/4}}{1+x}\,\mathrm{d}x\tag{1}
$$
Then, as in this answer, handle the three integrals
$$
\int_0^\infty\frac{x^{-\alpha}}{1+x}\,\mathrm{d}x\tag{2}
$$
using $\log(z)=\log(x)$ on the top of the real axis and $\log(z)=\log(x)+2\pi i$ on the bottom. This gives
$$
\int_\gamma\frac{z^{-\alpha}}{1+z}\,\mathrm{d}z=\left(1-e^{-2\pi i\alpha}\right)\int_0^\infty\frac{x^{-\alpha}}{1+x}\,\mathrm{d}x\tag{3}
$$
since the integral along the large and small circular contours vanish.
We can now use contour integration to say that the contour integral above is equal to the residue at $z=-1$. That is,
$$
\int_\gamma\frac{z^{-\alpha}}{1+z}\,\mathrm{d}z=2\pi i\,e^{-\pi i\alpha}\tag{4}
$$
Combine $(3)$ and $(4)$ to get
$$
\begin{align}
\int_0^\infty\frac{x^{-\alpha}}{1+x}\,\mathrm{d}x
&=\frac{2\pi i}{e^{\pi i\alpha}-e^{-\pi i\alpha}}\\
&=\frac{\pi}{\sin(\pi\alpha)}\tag{5}
\end{align}
$$
Use $(5)$ to evaluate the three pieces in $(1)$:
$$
\frac14\left(\frac\pi{1/\sqrt2}+\frac\pi{1}+\frac\pi{1/\sqrt2}\right)
=\pi\,\frac{1+2\sqrt2}{4}\tag{6}
$$
