Here is another method that relies on a small trick.
If $f$ and $g$ are differentiable functions, as
$$\frac{d}{dx} (e^{f(x)} g(x)) = e^{f(x)}[f'(x) g(x) + g'(x)],$$
it is immediate that
$$\int e^{f(x)} \left (f'(x) g(x) + g'(x) \right ) \, dx = e^{f(x)} g(x) + C.$$
In the case of the integral
$$\int e^{-\frac{x^2}{2}} \frac{x^4 + 2x^2 - 1}{(x^2 + 1)^2}, dx,$$
Here $f(x) = -x^2/2$, $f'(x) = -x$. For the function $g$ we have
$$f'(x) g(x) + g'(x) = - x g(x) + g'(x) = \frac{x^4 + 2x^2 - 1}{(x^2 + 1)^2}.$$
Conjuring up the function $g(x)$ is the hard bit. The squared term appearing in the denominator suggests we try something like: $g(x) = h(x)/(x^2 + 1)$. After a little trial and error it is not too hard to see that $h(x)$ must be $-x$ and we have
$$g(x) = -\frac{x}{x^2 + 1}.$$
Thus
$$\int e^{-\frac{x^2}{2}} \frac{x^4 + 2x^2 - 1}{(x^2 + 1)^2}, dx = -\frac{x}{x^2 + 1} e^{-\frac{x^2}{2}} + C.$$