How can I evaluate $\int_{-\infty}^{\infty}\frac{e^{-x^2}(2x^2-1)}{1+x^2}dx$?
I will evaluate the integral
$$I=\int_{-\infty}^\infty\frac{e^{-x^2}}{1+x^2}dx$$
using one of my favorite techniques (which I have heard was also Richard Feynman's favorite). This will solve your problem since, as Dilip points out, your integral can be written as
$$\int_{-\infty}^\infty\frac{e^{-x^2}(2x^2+2-3)}{1+x^2}dx=2\sqrt{\pi}-3I.$$
To find the value of $I$, we let, for $t\geq 0$,
$$I(t)=\int_{-\infty}^\infty\frac{e^{-tx^2}}{1+x^2}dx.$$
Then $I(0)=\arctan{\infty}-\arctan{(-\infty)} = \pi$, and $$I'(t)=\int_{-\infty}^\infty\frac{-x^2e^{-tx^2}}{1+x^2}dx.$$
Hence $I(t)$ satisfies the differential equation
$$I(t)-I'(t)=\int_{-\infty}^\infty e^{-tx^2}dx = \sqrt{\frac{\pi}{t}}.$$
Multiplying throughout by $e^{-t}$ we have
$$-\frac{d}{dt}(e^{-t}I(t)) = e^{-t}\sqrt{\frac{\pi}{t}}.$$
Integrating from $t=0$ to $t$, we find
$$-e^{-t}I(t)+I(0) = \sqrt{\pi} \int_0^t \frac{e^{-t}}{\sqrt t}dt = 2\sqrt{\pi} \int_0^\sqrt{t}e^{-u^2} du = \pi \text{ erf}\sqrt{t}$$
Since $I(0)=\pi$, we have
$$I(t)=e^t(\pi - \pi \text{ erf}(\sqrt{t})) = e^{t}\pi \text{ erfc}(\sqrt{t}).$$
Thus $I=I(1) = e\pi\: \text{erfc}(1)$, and your integral is $2\sqrt\pi - 3e\pi\text{erfc}(1)$. (Look!)
Note: my other solution below is much quicker, but not as much fun.
Here is yet another way to evaluate the integral
$$I=\int_{-\infty}^\infty \frac{e^{-x^2}}{1+x^2}dx.$$ Write
$$\frac{1}{1+x^2}= \int_0^\infty e^{-s(1+x^2)}ds,$$
so that
$$I=\int_{-\infty}^\infty e^{-x^2} \int_{0}^\infty e^{-s(1+x^2)}ds\: dx.$$
We switch the order of integration to get
$$\int_{0}^\infty e^{-s} \int_{-\infty}^\infty e^{-x^2(1+s)}dx\: ds = \int_{0}^\infty e^{-s} \sqrt{\frac{\pi}{1+s}} ds = e\sqrt{\pi}\int_{0}^\infty \frac{e^{-(s+1)}}{\sqrt{1+s}} ds = e\pi \text{ erfc}(1).$$
(To see that this last integral is indeed $\sqrt\pi \text{ erfc}(1)$, put $u=\sqrt{1+s}$, $du= \frac{ds}{2\sqrt{1+s}}$.)
To find $I=\int_{-\infty}^{\infty}\frac{e^{-x^2}(2x^2-1)}{1+x^2}dx$, let us start by defining for $n \in \mathbb{N}$ $$ I_n = \int_{-\infty}^{\infty} x^{2n} e^{-x^2}\,dx $$ and note that $I_0=\sqrt{\pi}$, also called the Gaussian integral, can be solved either by a beautiful polar coordinate trick or by this technique, and that $I_1=\frac{\sqrt{\pi}}{2}$ was shown here. We can find the rest using integration by parts. With $$ \begin{array}{lcl} v=-\frac{1}{2}e^{-x^2} && dv=xe^{-x^2}dx \\ u=x^{2n-1} && du=(2n-1)x^{2n-2}dx, \end{array} $$ for $n>1$ we have $$ \begin{array}{lcl} I_n &=& \int udv = uv - \int vdu \\ &=& -\frac{1}{2} \left[ x^{2n-1} e^{-x^2} \right]_{-\infty}^{\infty} + \frac{2n-1}{2} \int_{-\infty}^{\infty} x^{2n-2} e^{-x^2} \\ &=& \frac{2n-1}{2} I_{n-1} \end{array} $$ where the first right-hand term vanishes because the exponential term dominates all polynomial terms. This shows that, inductively, $$ I_n = \frac{(2n)!}{2^{2n}n!} I_0 $$ But using $\frac{1}{1-t}=\sum_{n=0}^{\infty}t^n$, we can expand the integrand of $I$: $$ \frac{2x^2-1}{1+x^2} = (2x^2-1) \sum_{n=0}^{\infty} (-1)^n x^{2n} = 2-3\sum_{n=0}^{\infty} (-1)^n x^{2n} $$ and hence we get (noting that the integrals all converge because of the dominating exponential term) $$ \begin{array}{lcl} I &=& 2I_0-3(I_0-I_1+\dots) = 2I_0-3 \sum_{n=0}^{\infty} (-1)^n I_n \\ &=& \left( 2-3 \sum_{n=0}^{\infty} (-1)^n \frac{(2n)!}{2^{2n}n!} \right) I_0 \end{array} $$ where the series $$ \sum_{n=0}^{\infty} (-1)^n \frac{(2n)!}{2^{2n}n!} = 1 - \frac{1}{2} + \frac{1 \cdot 3}{2 \cdot 2} - \frac{1 \cdot 3 \cdot 5}{2 \cdot 2 \cdot 2} + \cdots = e \sqrt\pi\; \text{erfc}(1) $$ can also be expressed using $\Gamma(\frac{1}{2}-n)=(-1)^n\frac{(2n)!}{4^{n}n!}\sqrt\pi$ and a series expansion for the complementary error function as $$ I = 2\sqrt\pi - 3 \; \sum_{n=0}^{\infty} \; \Gamma(\tfrac{1}{2}-n) = 2\sqrt\pi - 3e\pi\;\text{erfc}(1) \;. $$