$\int_{-\infty}^\infty \frac{\sin (t) \, dt}{t^4+1}$ must be zero and it isn't I'm trying to evaluate the integral
$$\int_{-\infty}^\infty \frac{\sin (t) \, dt}{t^4+1}$$ using residue and complex plane integration theory.
Let $f(t):=\frac{\sin (t)}{t^4+1}$, $f(z):= \frac{\sin (z)}{z^4+1}$. Then $f(z)$ has four singular points, two of which are in the semicircle $R>2$ in the upper  half of the complex plane: $p_1:=\exp\{i\frac{\pi}{4}\}$ and $p_2:=\exp\{i\frac{3\pi}{4}\}$.
We know that $$\int_{-R}^R \frac{\sin (t) \, dt}{t^4+1}+\int_{C_R}\frac{\sin (z) \, dz}{z^4+1}=2\pi i(\operatorname{Res}_{z=p_1}+\operatorname{Res}_{z=p_2})$$
But here's the mysterious part:
$$\lim_{R\to\infty}\int_{C_R}\frac{\sin (z) \, dz}{z^4+1}=0$$
yet $$(\operatorname{Res}_{z=p_1}+\operatorname{Res}_{z=p_2})\ne 0$$
But the original integral must be equal to zero. I'd appreciate if it could be pointed out what I'm not doing right.
 A: This :$$\lim_{R\to\infty}\int_{C_R}\frac{\sin (z) \, dz}{z^4+1}=0$$ is false because of the sine. (Which is NOT bounded on $\mathbb{C}$) The usual trick is to consider the integral $$\int_{-\infty}^{+\infty} \frac{e^{it}}{t^4+1} dt,$$ to compute it by residue using Jordan's Lemma and then to take the imaginary part to get the integral you want.
A: You have $\displaystyle f(t) = \frac{\sin t}{t^4 + 1}$.  Instead of considering $f(z)$ for $z \in \Bbb{C}$, consider the function $\displaystyle g(z) = \frac{e^{iz}}{z^4 + 1}$ for $z \in \Bbb{C}$.  We do this in general because $e^{iz}$ behaves better (i.e., it's bounded) on $\{z = x + iy \in \Bbb{C} : y \ge 0 \}$ than $\sin z$ does on this set.
Let $\gamma$ be the standard semicircular contour.  Then we have
$$ \int_\gamma \frac{e^{iz}}{z^4 + 1} \, dz = \int_{-R}^R \frac{e^{it}}{t^4+1} \, dt + \int_{\text{arc}} \frac{e^{iz}}{z^4+1} \, dz,$$
where "arc" represents the curved part of the contour $\gamma$.  In can be shown that the integral over "arc" tends to zero as $R \to +\infty$.  Just parameterize with $z = Re^{i\theta}$ and use the ML-estimate.  Also, we can evaluate the left-hand side with residues:
$$ \int_\gamma \frac{e^{iz}}{z^4 + 1} \, dz = 2\pi i \sum_{z \in \Gamma} \text{Res } g(z),$$
where I'm using $\Gamma$ to represent the interior of the closed contour $\gamma$.  There are two residues as you mentioned.  They occur at $z = e^{\pi i/4}$ and $z = e^{3\pi i/4}$.  Note that I'm using exponential form for simplicity.  Also note that, in exponential notation, $z^4 + 1$ factors as $$z^4 + 1 = (z-e^{\pi i/4})(z - e^{3\pi i/4})(z - e^{5\pi i/4})(z - e^{7\pi i/4}).$$
First residue:
\begin{align}
  \text{Res}\left(g(z), z= e^{\pi i/4}\right)
    &= \lim_{z \to e^{\pi i/4}} \left(z - e^{\pi i/4}\right) \frac{e^{iz}}{(z-e^{\pi i/4})(z - e^{3\pi i/4})(z - e^{5\pi i/4})(z - e^{7\pi i/4})}\\[0.3cm]
    &= \lim_{z \to e^{\pi i/4}} \frac{e^{iz}}{(z - e^{3\pi i/4})(z - e^{5\pi i/4})(z - e^{7\pi i/4})}\\[0.3cm]
    &= \frac{e^{ie^{\pi i/4}}}{(e^{\pi i/4} - e^{3\pi i/4})(e^{\pi i/4} - e^{5\pi i/4})(e^{\pi i/4} - e^{7\pi i/4})}\\[0.3cm]
    &= -e^{ie^{\pi i/4}}\frac{\sqrt{2}}{8}(1 + i)
\end{align}
Similarly, the other residue is $e^{ie^{3\pi i/4}}\dfrac{\sqrt{2}}{8}\left(1 - i\right)$.  Yes, I'm skipping a lot of messy arithmetic here.  Exercise left for the reader. :)
Anyway, with the help of a computer algebra system, I find that the sum of the residues is (equivalent to)
$$ -\frac{i}{4} e^{-1/\sqrt{2}}\sqrt{2}\left(\cos \frac{1}{\sqrt{2}} + \sin\frac{1}{\sqrt{2}}\right). $$
This is a mess.  But that's ok.  Note that it's purely imaginary, and that's the only thing we care about regarding this expression.  This means that if we multiply it by $2\pi i$, we get a real value.  This means that
$$ \int_\gamma \frac{e^{iz}}{z^4 + 1} \, dz $$
is real.  Finally, note also that $e^{it} = \cos t + i\sin t$.  Therefore, when we take the limit as $R \to +\infty$, we have:
\begin{align}
  \int_\gamma \frac{e^{iz}}{z^4 + 1} \, dz &= \int_{-\infty}^{+\infty} \frac{e^{it}}{t^4+1} \,dt\\[0.3cm]
    &= \int_{-\infty}^{+\infty} \frac{\cos t + i\sin t}{t^4 + 1} \, dt\\[0.3cm]
    &= \underbrace{\int_{-\infty}^{+\infty} \frac{\cos t}{t^4+1} \, dt}_{\text{real part}} + i \cdot \underbrace{\int_{-\infty}^{+\infty} \frac{\sin t}{t^4 + 1} \, dt}_{\text{imaginary part}}
\end{align}
Recall that the integral over $\gamma$ is real.  Therefore its imaginary part is zero.  So if we equate real and imaginary parts then we get
$$ \int_{-\infty}^{+\infty} \frac{\sin t}{t^4 + 1} \, dt = 0.$$
