Residue theorem for a rational function

You are on the right track. By the Residue Theorem $$\begin{align}\int_{-\infty}^{\infty}\frac{x^4}{1+x^8}dx&= 2\pi i\sum_{n=0}^3\left.\frac{z^4}{8z^7}\right|_{z=w_n}=\frac{\pi i}{4}\left(w_0^{-3}+w_1^{-3}+w_2^{-3}+w_3^{-3}\right)\\ &=\frac{\pi}{4}\left(\sin(3\pi/8)+\sin(9\pi/8)+\sin(15\pi/8)+\sin(21\pi/8)\right)\\&=\frac{\pi}{2}\left(\sin(3\pi/8)-\sin(\pi/8)\right) =\frac{\pi}{\sqrt{2}}\sin(\pi/8) \end{align}$$ where $w_n=z=e^{\frac{i \pi}{8}\left ( 2n+1 \right )}$.

P.S. Note that by the half-angle formula $$\sin(\pi/8)=\sqrt{\frac{1-\cos(\pi/4)}{2}}=\sqrt{\frac{1-1/\sqrt{2}}{2}}.$$


You can use the following reasoning. $$\frac{x^4}{x^8+1}=\frac{x^4}{(x^4+\sqrt2x^2+1)(x^4-\sqrt2x^2+1)}=$$ $$=\frac{1}{2\sqrt2}\left(\frac{x^2}{x^4-\sqrt2x^2+1}-\frac{x^2}{x^4+\sqrt2x^2+1}\right)=$$

$$=\frac{1}{2\sqrt2}\left(\tfrac{x^2}{\left(x^2+\sqrt{2-\sqrt2}x+1\right)\left(x^2-\sqrt{2-\sqrt2}x+1\right)}-\tfrac{x^2}{\left(x^2+\sqrt{2+\sqrt2}x+1\right)\left(x^2-\sqrt{2+\sqrt2}x+1\right)}\right)=...$$


You have a good answer already. But here is a slick way to do the integration. First note that: \begin{align} \int^\infty_{-\infty} \frac{x^4}{x^8+1}dx= \text{Re} \int^\infty_{-\infty} \frac{1}{x^4-i}dx \end{align} Now you have reduced the problem with calculating 4 residues to just 2 residues. And in the upper half plane they are at $\exp({\frac{1}{8} i\pi}) $ and $\exp({\frac{5}{8} i\pi})$. Don't forget to take the real part after you have finished the calculation.