How to calculate an integral using Cauchy's theorem? The question is calculate the value of the integral,
$$\int_{-\infty}^{\infty}\frac{dx}{1+x^4}$$
These are the steps that I followed,
Let $x$ be a complex number. So, the poles of the function $f(x)=\frac{1}{1+x^4}$ occur when $x$ is equal to the roots of the equation $1+x^4=0$, i.e $x=e^{i\pi/4},e^{3i\pi/4},e^{5i\pi/4},e^{7i\pi/4}$. They are all poles of degree 4.
Now Cauchy's theorem says that,
$$\frac{1}{2\pi i}\int_C dx\ f(x)=\sum_i\text{Res}(f,x_i)$$ where $x_i$ are the poles of $f$ that lies within $C$. I am pretty sure that my poles lie within $-\infty$ and $\infty$. So, I calculated the residues of $\frac{1}{1+x^4}$ at $x=e^{i\pi/4},e^{3i\pi/4},e^{5i\pi/4},e^{7i\pi/4}$ and they are equal to $-\frac14e^{i\pi/4},-\frac14e^{3i\pi/4},-\frac14e^{5i\pi/4},-\frac14e^{7i\pi/4}$. Wolfram Alpha confirms my calculations. 
The sum of residues is $$\sum_i\text{Res}=-\frac14e^{i\pi/4}-\frac14e^{3i\pi/4}-\frac14e^{5i\pi/4}-\frac14e^{7i\pi/4}=0$$ and therefore the integral,
$$\int_{-\infty}^{\infty}\frac{dx}{1+x^4}$$
must be equal to zero. However, Wolfram alpha says it is not zero but equal to$\frac{\pi}{\sqrt 2}$. Where am I making a mistake?
 A: In applying the residue theorem, we analyze the integral $I$ given by 
$$\begin{align}
I&=\oint_C \frac{1}{1+z^4}\,dz\\\\
&=\int_{-R}^R \frac{1}{1+x^4}\,dx+\int_0^\pi \frac{1}{1+(Re^{i\phi})^4}\,iRe^{i\phi}\,d\phi\\\\
&=2\pi i \,\text{Res}\left(\frac{1}{1+z^4}, z=e^{i\pi/4},e^{i3\pi/4}\right) 
\end{align}$$
where $R>1$ is assumed.


Note that the only residues implicated in the residue theorem are those enclosed by $C$.  Here, $C$ is comprised of (i) the line segment from $-R$ to $R$ and (ii) the semicircular arc centered at the origin with radius $R$ and residing in the upper-half plane.  Hence, the only resides are the ones at $z=e^{i\pi/4}$ and $z=e^{i3\pi/4}$.


Taking $R\to \infty$, the integration over the semi-circular contour vanishes and we find that 
$$\begin{align}
\int_{-\infty}^\infty \frac{1}{1+x^4}\,dx&=2\pi i \,\text{Res}\left(\frac{1}{1+z^4}, z=e^{i\pi/4},e^{i3\pi/4}\right)\\\\
&=2\pi i \left(-\frac{e^{i\pi/4}}{4}-\frac{e^{i3\pi/4}}{4}\right)\\\\
& =\frac{\pi}{\sqrt 2}
\end{align}$$
A: You shouldn't need Wolfram Alpha to tell you the answer isn't zero. The integrand is positive, so the integral is positive, and certainly nonzero.
You have added up the residues at all the poles. However using the usual semicircle method gives you that the integral is $2\pi i$ times the sum of the residues of the poles in the upper half-plane.
