Write the integral as
$$\frac{1}{\pi} \int_{-\infty}^{\infty} dx \: \frac{\exp (i a x)}{ (1+x^2)}$$
which is still real because the imaginary part vanishes over the symmetric interval. Now consider the following complex integral
$$ \int_{C} dz \: \frac{\exp (i a z)}{ (1+z^2)}$$
where $C$ is the following contour for $a > 0$:

The value of this integral is equal to $i 2 \pi$ times the sum of the residues of the poles of the integrand inside $C$. These poles are at $z = \pm i$, and the residues of the integrand at these poles are
$$\mathrm{Res}_{z=\pm i} \frac{\exp (i a z)}{ (1+z^2)} = \pm \frac{\exp{(\mp a)}}{i 2}$$
For the contour $C$, only the residue at $z=i$ is inside, so the value of the integral is
$$ \int_{C} dz \: \frac{\exp (i a z)}{ (1+z^2)} = i 2 \pi \frac{\exp{(-a)}}{i 2} = \pi \exp{(-a)}$$
This integral may also be expressed in terms of the integral over the two individual components of contour $C$:
$$ \int_{C} dz \: \frac{\exp (i a z)}{ (1+z^2)} = \int_{-R}^{R} dx \: \frac{\exp (i a x)}{ (1+x^2)} + i R \int_{0}^{\pi} d \phi \: \exp{(i \phi)} \frac{\exp (i a R \exp{(i \phi)})}{ (1+R^2 \exp{(i 2 \phi)})} $$
where $R$ is the extent of $C$ along the $\Re{z}$ axis. Note that the second integral on the right-hand side results from a substitution $z = R \exp{(i \phi)}$ and corresponds to the integral along the semicircle. We take the limit as $R \rightarrow \infty$. Note that the first integral becomes the integral we seek, and we want to show that the second integral vanishes in this limit. In fact, it turns out that
$$ \left | i R \int_{0}^{\pi} d \phi \: \exp{(i \phi)} \frac{\exp (i a R \exp{(i \phi)})}{ (1+R^2 \exp{(i 2 \phi)})} \right | \approx \frac{1}{R} \int_{0}^{\pi} d \phi \: \exp{(-a R \cos{\phi})}, \: \: (R \rightarrow \infty) $$
which only converges when $a>0$; for this case, the integral vanishes as $R \rightarrow \infty$, and we can say:
$$\frac{1}{\pi} \int_{-\infty}^{\infty} dx \: \frac{\exp (i a x)}{ (1+x^2)} = \exp{(-a)} , \: \: a>0$$
When $a<0$, we flip the contour about the $\Re{z}$ axis and use the pole at $z=-i$ for the residue. In this case, we find that
$$\frac{1}{\pi} \int_{-\infty}^{\infty} dx \: \frac{\exp (i a x)}{ (1+x^2)} = \exp{(a)} , \: \: a<0$$
Combining these results and returning to the original integral expression, we get the result you sought:
$$\int_{-\infty}^{\infty} dx \: \frac{\cos(a x)}{\pi (1+x^2)} = \exp({-|a|)}$$