<s>[INST] How to find this integral $\int_{0}^{\infty}\dfrac{f(x)}{g(x)}dx$ show that:
$$I=\int_{0}^{\infty}\dfrac{x^8-4x^6+9x^4-5x^2+1}{x^{12}-10x^{10}+37x^8-42x^6+26x^4-8x^2+1}dx=\dfrac{\pi}{2}$$
I found this :
$$\dfrac{x^8-4x^6+9x^4-5x^2+1}{x^{12}-10x^{10}+37x^8-42x^6+26x^4-8x^2+1}=x^4-6x^2+4+\dfrac{33x^6-41x^4+18x^2-3}{x^8-4x^6+9x^4-5x^2+1}dx$$
See Wolfram Alpha.
 [/INST] Partial Answer :
Notice that
\begin{align}
I&=\int_{0}^{\infty}\dfrac{x^8-4x^6+9x^4-5x^2+1}{x^{12}-10x^{10}+37x^8-42x^6+26x^4-8x^2+1}dx\\
&=\frac12\int_{-\infty}^{\infty}\dfrac{x^8-4x^6+9x^4-5x^2+1}{x^{12}-10x^{10}+37x^8-42x^6+26x^4-8x^2+1}dx\\
\end{align}
The above integral can be evaluated by using residue method but it will be very messy. Let's try to make a bit easier. The integrand can be decomposed as
$$
\frac{1}{2} \left( \frac{x^2+2x+1}{x^6 + 4x^5 + 3x^4 - 4x^3 - 2x^2 + 2x + 1} + \frac{x^2 - 2x + 1}{x^6 - 4x^5 + 3x^4 + 4x^3 - 2x^2 - 2x + 1} \right)
$$
or
$$
\frac{1}{2} \left( \frac{(x+1)^2}{x^6 + 4x^5 + 3x^4 - 4x^3 - 2x^2 + 2x + 1} + \frac{(x-1)^2}{x^6 - 4x^5 + 3x^4 + 4x^3 - 2x^2 - 2x + 1} \right).
$$
Setting $u=x+1$ and $v=x-1$ we will obtain
$$
\frac{1}{2} \left( \frac{u^2}{u^6-2u^5-2u^4+4u^3+3u^2-4u+1} + \frac{v^2}{v^6+2v^5-2v^4-4v^3+3v^2+4v+1} \right).
$$
Consider the complex polynomials
$$
p(z)=z^3-(1+i)z^2-(2-i)z+1
$$
where $p(z)$ has three distinct complex roots, say $z_1, z_2,$ and $z_3$. Hence
\begin{align}
I_1&=\int_{-\infty}^{\infty}\frac{u^2}{u^6-2u^5-2u^4+4u^3+3u^2-4u+1}\ du\\
&=\int_C\frac{z^2}{z^6-2z^5-2z^4+4z^3+3z^2-4z+1}\ dz\\
&=\int_C\frac{z^2}{p(z)p^*(z)}\ dz\\
&=2\pi i\sum_{k=1}^3\text{Res}\left[\frac{z^2}{p(z)p^*(z)},z_k\right],
\end{align}
where $C$ is a semicircular contour in the upper half-plane with diameter $[-R,R]$ and as $R\to\infty$  the integral vanishes about the circular arcs. It's easy to see by using $ML$ inequality or $\displaystyle\lim_{z\to0} zf(z)=0$. Although, the things will be a bit messy the given integral can be evaluated by residue method easier than the previous one since we only deal with three distinct complex roots and also their conjugates.
</s>