I want to compute $$\int_{0}^{\infty} \frac{x}{x^{4}+1} dx$$ using complex analysis. Now the first thing that strikes me is that $f(x)$ is not an even function. So this troubles me a bit since I would normally use
$$\int_{0}^{\infty} f(x)dx = \frac{1}{2} \left[\lim_{R \rightarrow \infty} \int_{-R}^{R} f(z)dz + \int_{C_{R}}f(z)dz \right], $$ where $C_{R}$ is the semi cirle connecting $R$ to $-R$ in the positive imaginary part. Now we see that we have to compute the singularities of $f(z)$, which we can do by computing the fourth root of $z$. We then find $$ \begin{align*} z^{4} &= e^{i (\pi + 2n\pi)} \\ z &= e^{i ( \frac{\pi}{4} + \frac{n\pi}{2} )} \end{align*}. $$
Since we are only interested in singularities above the real line, we find $z_{0} = e^{i \frac{\pi}{4}}$ and $z_{1} = e^{i \frac{3\pi}{4}}$.
Then we let $p(z) = z$ and $q(z) = z^{4}+1$, which makes $q'(z) = 4z^{3}$. We then compute $p(z_{0}), q(z_{0})$ and $q'(z_{0})$ and finally $\frac{p(z)}{q'(z)}$ which equals the residue at $z_{0}$.
However, when I do the above I find $\text{Res}(z_{0}) = - \frac{i}{4}$ and $\text{Res}(z_{1}) = \frac{i}{4}$ but this would make the integral equal zero since $2\pi i (\frac{i}{4} - \frac{i}{4})=0$.
Can anybody point me to my mistake? Also, when would find the value for this integral, I would argue we can not simply take half of it, since the initial function is not even. How would we fix that?
So i would take the following contour: $[0,R],$ $C_R$ and $[iR,0]$ where $C_R$ connects $R$ and $iR.$ So, instead of a semicircle, you have a quarter of a circle. Notice that, by doing this, just one of your singularities is inside, mainly $e^{i\frac{\pi}{4}}$ hence your integral $$\int _{[0,R]}+\int _{C_R}+\int _{[iR,0]}=2\pi i\frac{-i}{4}=\frac{\pi}{2}.$$ Check that the integral vanishes in $C_R$ and make a change of variable, perhaps, $y=ix$ to convert the integral in $[iR,0]$ to an integral in $[0,R].$