Residue/Contour integration problem Supposedly, 
$\displaystyle\int_{-\infty}^\infty \frac{\cos ax}{x^4+1}dx=\frac{\pi}{\sqrt{2}}e^{-a/\sqrt{2}}\left(\cos\frac{a}{\sqrt{2}}+\sin\frac{a}{\sqrt{2}}\right)$, $a>0$.
Using Residues/Contour integrals, I have 
$\displaystyle\int_{-\infty}^\infty \frac{e^{iax}}{x^4+1}dx=\int_{-\infty}^\infty \frac{\cos ax}{x^4+1}dx+i\int_{-\infty}^\infty \frac{\sin ax}{x^4+1}dx=\frac{\pi}{\sqrt{2}}e^{-a/\sqrt{2}}\left(\cos\frac{a}{\sqrt{2}}+i\sin\frac{a}{\sqrt{2}}\right)$
I don't see how to draw the final conclusion. 
 A: Here, because $a >0$, it is easiest to use a contour $C$ that is a semicircle of radius $R$ in the  upper half-plane in the complex plane.  Thus, consider
$$\oint_C dz \frac{e^{i a z}}{z^4+1} $$
This contour integral is equal to
$$\int_{-R}^{R} dx  \frac{e^{i a x}}{x^4+1} + i R \int_0^{\pi} d\theta \, e^{i \theta} \frac{e^{-a R \sin{\theta}} e^{i a R \cos{\theta}}}{R^4 e^{i 4 \theta}+1}  $$
As $R \to \infty$, the magnitude of the second integral vanishes as
$$\frac{2}{R^3} \int_0^{\pi/2} d\theta\, e^{-a R \sin{\theta}} \le \frac{2}{R^3} \int_0^{\pi/2} d\theta e^{-2 a R/\pi} \le \frac{\pi}{R^4}$$
The contour integral is also equal to $i 2 \pi$ times the sum of the residues of the poles within $C$.  These poles are at $z=e^{i \pi/4}$ and $e^{i 3 \pi/4}$.  The integral we seek is therefore found through the following equality:
$$\begin{align}\int_{-\infty}^{\infty} dx  \frac{e^{i a x}}{x^4+1} &= i 2 \pi \left [\frac{e^{-a/\sqrt{2}} e^{i a/\sqrt{2}}}{4 e^{i 3 \pi/4}} + \frac{e^{-a/\sqrt{2}} e^{-i a/\sqrt{2}}}{4 e^{i 9 \pi/4}} \right ]\\ &= i\frac{\pi}{2} e^{-a/\sqrt{2}} e^{-i \pi/2} \left [e^{i(a/\sqrt{2}-\pi/4)} +  e^{-i(a/\sqrt{2}-\pi/4)}\right ]\\ &= \pi  \, e^{-a/\sqrt{2}} \cos{\left (\frac{a}{\sqrt{2}}-\frac{\pi}{4} \right )} \\ &= \pi  \, e^{-a/\sqrt{2}} \frac{1}{\sqrt{2}} \left (\cos{\frac{a}{\sqrt{2}}} + \sin{\frac{a}{\sqrt{2}}} \right )\end{align}$$
Because cosine is even and sine is odd, the desired integral is equal to the above result, as was to be shown.
A: Here is an answer that uses a quarter-circle instead of a semicircle. Start by observing that
$$\int_{-\infty}^\infty \frac{\cos(ax)}{x^4+1} dx
= 2\int_0^\infty \frac{\cos(ax)}{x^4+1} dx
= 2 \times\Re\left(\int_0^\infty \frac{e^{iax}}{x^4+1} dx\right).$$
Now use a contour consisting of three segments to evaluate the integral, a line segment $\Gamma_1$ along the real axis from the origin to $R$, a quarter circle $\Gamma_2$ to $iR$ on the imaginary axis and another line segment $\Gamma_3$ along the imaginary axis back to the origin.
Clearly along $\Gamma_1$ we get the desired integral in the limit. Along $\Gamma_2$ we can parameterize with $z=Re^{it},$ applying the M-L inequality to get
$$\left|\int_{\Gamma_2} \frac{e^{iaz}}{z^4+1} dz\right|\le
\frac{\pi}{2} R\times 
\max_{0\le t\le \pi/2}
\left|\frac{e^{ia(R\cos(t)+iR\sin(t))}}{R^4 e^{4it} +1} \right|
\\ \le \frac{\pi}{2} R\times 
\max_{0\le t\le \pi/2} \frac{e^{-aR\sin(t)}}{R^4-1}
\le \frac{\pi}{2} R\times \frac{1}{R^4-1}
\to 0 \quad\text{as}\quad R\to \infty.$$
This integral vanishes in the limit and will not be contributing. Along $\Gamma_3$ we can parameterize with $z=it$ where $0\le t\le R,$ getting
$$\left|\int_{\Gamma_3} \frac{e^{iaz}}{z^4+1} dz\right|=
\left|-\int_0^R \frac{e^{-at}}{t^4+1} i\;dt\right|\le
\int_0^R \left|\frac{e^{-at}}{t^4+1}\right|dt
<\int_0^R e^{-at}dt \le C,$$
so this integral converges. This is all we need to know since it is purely imaginary and hence does not contribute to the value we are trying to compute.
Applying the Cauchy Residue Theorem to this contour, there is only one pole inside it, the one at $z=e^{\pi i/4} = \frac{\sqrt{2}}{2} + i \frac{\sqrt{2}}{2},$ and we conclude that the desired value is
$$2 \times 2\pi \times
-\Im\left(\mathrm{Res}\left(\frac{e^{iaz}}{z^4+1};z=e^{i\pi/4}\right)\right).$$
Now the residue is 
$$\left.\frac{e^{iaz}}{4z^3}\right|_{z=e^{i\pi/4}} =
- \frac{1}{4} e^{i\pi/4}
\exp\left(ia \left(\frac{\sqrt{2}}{2} + i \frac{\sqrt{2}}{2}\right)\right)
\\= - \frac{1}{4} 
\left(\frac{\sqrt{2}}{2} + i \frac{\sqrt{2}}{2}\right)
\exp\left(ia\frac{\sqrt{2}}{2} - a\frac{\sqrt{2}}{2}\right)
\\= - \frac{1}{4} \exp\left( - a\frac{\sqrt{2}}{2}\right)
\left(\frac{\sqrt{2}}{2} + i \frac{\sqrt{2}}{2}\right)
\left(\cos\frac{a}{\sqrt{2}}+i\sin\frac{a}{\sqrt{2}}\right).$$
Extracting the imaginary part from this residue we get for our end result the value
$$2 \times 2\pi \times \frac{1}{4} \exp\left( - a\frac{\sqrt{2}}{2}\right)
\frac{\sqrt{2}}{2}\left(\cos\frac{a}{\sqrt{2}}+\sin\frac{a}{\sqrt{2}}\right) =
\frac{\pi}{\sqrt{2}} \exp\left( - a\frac{\sqrt{2}}{2}\right)
\left(\cos\frac{a}{\sqrt{2}}+\sin\frac{a}{\sqrt{2}}\right).$$
