Integrating $\int_{-\infty}^\infty \frac{1}{1 + x^4}dx$ with the residue theorem Calculate integral
$$\int\limits_{-\infty}^{\infty}\frac{1}{x^4+1} dx$$
with residue theorem. 
Can I evaluate $\frac 12\int_C  \dfrac{1}{z^4+1} dz$ where $C$ is simple closed contour of the upper half of unit circle like this? 
And find the roots of polynomial $z^4 +1$ which are the fourth roots of $-1$. 
In $C$ there is $z_1 =e^{i\pi/4}=\frac{1}{\sqrt{2}}+\frac{i}{\sqrt{2}}$ and $z_2=e^{3\pi/4}=-\frac{1}{\sqrt{2}}+\frac{i}{\sqrt{2}}$.
So the residuals $B_1$ and $B_2$ for $z_1$ and $z_2$ are simple poles and that
\begin{align}
B_1&=\frac{1}{4 z_1^3}\frac{z_1}{z_1}=-\frac{z_1}{4} \\
B_2&=\frac{1}{4z_2^3}\frac{z_2}{z_2}=-\frac{z_2}{4}
\end{align}
And the sum of residuals is
$$B_1+B_2=-\frac{1}{4}(z_1 + z_2)=-\frac{1}{4}\left(\frac{1}{\sqrt{2}}+\frac{1}{\sqrt{2}} \right)=-\frac{i}{2 \sqrt{2}}$$
So my integral should be
$$\int\limits_{-\infty}^{\infty}\frac{1}{x^4+1} dx =\frac 12 \times 2\pi i (B_1+B_2)=\frac{\pi}{\sqrt{2}}$$
Is this valid?
 A: I thought that it might be instructive to present an alternative and efficient approach.  To do so, we first note that from the even symmetry that 
$$\int_{-\infty}^\infty \frac{1}{1+x^4}\,dx=2\int_{0}^\infty \frac{1}{1+x^4}\,dx \tag 1$$
We proceed to evaluate the integral on the right-hand side of $(1)$.

Next, we move to the complex plane and choose as the integration contour, the quarter circle in the upper-half plane with radius $R$.  Then, we can write  
$$\begin{align}
\oint_C \frac{1}{1+z^4}\,dz&=\int_0^R \frac{1}{1+x^4}\,dx+\int_0^\pi \frac{iRe^{i\phi}}{1+R^4e^{i4\phi}}\,d\phi+\int_R^0 \frac{i}{1+(iy)^4}\,dy\\\\
&=(1-i)\int_0^R\frac {1}{1+x^4}\,dx+\int_0^\pi \frac{iRe^{i\phi}}{1+R^4e^{i4\phi}}\,d\phi \tag 2
\end{align}$$
As $R\to \infty$, the second integral on the right-hand side of $(2)$ approaches $0$ while the first approaches the $1/2$ integral of interest.  Hence, we have

$$\bbox[5px,border:2px solid #C0A000]{\lim_{R\to \infty}\oint_C \frac{1}{1+z^4}\,dz=\frac{1-i}2 \int_{-\infty}^\infty \frac{1}{1+x^4}\,dx} \tag 3$$


Now, since $C$ encloses only the pole at $z=e^{i\pi/4}$, the Residue Theorem guarantees that 

$$\begin{align}\oint_C \frac{1}{1+z^4}\,dz&=2\pi i \text{Res}\left(\frac{1}{1+z^4}, z=e^{i\pi/4}\right)\\\\
&=\frac{2\pi i}{4e^{i3\pi/4}}\\\\
&=\frac{\pi e^{-i\pi/4}}{2}\\\\
&=\bbox[5px,border:2px solid #C0A000]{\frac{\pi(1-i)}{2\sqrt 2}} \tag 4
\end{align}$$


Finally, equating $(3)$ and $(4)$, we find that 

$$\bbox[5px,border:2px solid #C0A000]{\int_{-\infty}^\infty \frac{1}{1+x^4}\,dx=\frac{\pi}{\sqrt{2}}}$$

as expected.
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
$$\bbox[15px,#ffe,border:2px dotted navy]{\ds{%
\mbox{There is an interesting 'real integration' which I want to recall here}}}
$$
\begin{align}
\mc{J} & \equiv \int_{-\infty}^{\infty}{\dd x \over 1 + x^{4}} =
2\int_{0}^{\infty}{1 \over 1/x^{2} + x^{2}}\,{1 \over x^{2}}\,\dd x
\\[5mm] & = 
\overbrace{2\int_{0}^{\infty}{1 \over \pars{x - 1/x}^{2} + 2}\,
{1 \over x^{2}}\,\dd x}^{\ds{\mc{J}}}\label{1}\tag{1}
\\[5mm] & \stackrel{x\ \mapsto\ 1/x}{=}\,\,\,
\underbrace{2\int_{0}^{\infty}{\dd x \over \pars{1/x - x}^{2} + 2}}
_{\ds{\mc{J}}}
\label{2}\tag{2}
\end{align}
With \eqref{1} and \eqref{2} RHS:
\begin{align}
\mc{J} & = {\mc{J} + \,\mc{J} \over 2} =
\int_{0}^{\infty}{1 \over \pars{x - 1/x}^{2} + 2}\,
\pars{1 + {1 \over x^{2}}}\,\dd x
\,\,\,\stackrel{\pars{x - 1/x}\ \mapsto\ x}{=}\,\,\,
\int_{-\infty}^{\infty}{\dd x \over x^{2} + 2}
\\[5mm] & \,\,\,\stackrel{x/\root{2}\ \mapsto\ x}{=}\,\,\,
\root{2}\int_{0}^{\infty}{\dd x \over x^{2} + 1} =\
\bbox[15px,#ffe,border:2px dotted navy]{\ds{{\root{2} \over 2}\,\pi}}
\end{align}
