$$\int_{-\infty}^\infty \frac{x^2}{x^4+1}\;dx$$
I'm trying to understand trigonometric substitution better, because I never could get a good handle on it. All I know is that this integral is supposed to reduce to the integral of some power of cosine. I tried $x^2=\tan\theta$, but I ended up with $\sin\theta\cos^3\theta$ as my integrand. Can someone explain how to compute this?

Notice that: $$x^4 + 1 = x^4 + 2x^2 + 1 - 2x^2 = (x^2 + 1)^2 - 2x^2$$