There are some basic approaches to choosing a good contour.
You should ask yourself is where the singularities are.
Then you should take a look at your integral domain.
Then look for symmetries (including $\sin(x)=\Im(e^{ix})$ or $f(ix)=\dots$)
Then, you need to check the asymptotes of your integrand as you approach complex infinities (such as $\lim_{x\to i\infty}e^{ix}=e^{i^2\infty}=e^{-\infty}=0$ or $\left|\frac x{(x^2+1)^2}\right|\ll\frac1{x^3}$)
For your example, one might note that:
$$x=\pm i\implies\frac1{(x^2+1)^2}=\frac10\implies\text{singularities}$$
Our integral domain is $(-\infty,\infty)$, so we'll want to check if a semicircle contour works.
In the case that we were integrating on $[0,\infty)$, you would want to note that
$$\int_{-\infty}^\infty\frac1{(x^2+1)^2}~\mathrm dx=2\int_0^\infty\frac1{(x^2+1)^2}~\mathrm dx$$
which follows from the symmetry step.
Assymptotically as $|z|\to\infty$, we can see that
$$\left|\frac1{(z^2+1)^2}\right|\ll\left|\frac1{z^3}\right|$$
Since this decays faster than $\mathcal O(z^{-1})$, we know that
$$\begin{align}\lim_{R\to\infty}\left|\int_{\{Re^{i\theta}:\theta\in[0,\pi]\}}\frac1{(z^2+1)^2}~\mathrm dz\right|&\le\lim_{R\to\infty}\int_{\{Re^{i\theta}:\theta\in[0,\pi]\}}\left|\frac1{(z^2+1)^2}\right|~\mathrm dz\\&\ll\lim_{R\to\infty}\int_{\{Re^{i\theta}:\theta\in[0,\pi]\}}\left|\frac1{z^3}\right|~\mathrm dz\\&\le\lim_{R\to\infty}\pi R\max_{z\in\{Re^{i\theta}:\theta\in[0,\pi]\}}|z^{-3}|\\&=\lim_{R\to\infty}\frac\pi{R^2}\\&=0\end{align}$$
Thus, we find nicely that
$$\int_{-\infty}^\infty\frac1{(x^2+1)^2}~\mathrm dx=\lim_{z\to\infty}\oint_{\gamma_R}\frac1{(z^2+1)^2}~\mathrm dz$$
$\gamma_R=(-R,R)\cup\{Re^{i\theta}:\theta\in[0,\pi]\}$
And the rest requires the residue theorem.
Of course, not all integrals can be tackled using a semicircle contour. Some other contours you should keep in mind:
Keyhole contour
Rectangular contour
Wedge contour
Circle contour
Each having its own use depending on the integral at hand. For example, if a function has a branch cut along a certain line, try a keyhole contour with the keyhole centered at the branch point and the keyhole along the branch cut. If a keyhole contour doesn't look friendly because there are too many singularities inside it, a wedge contour may be more suited, chosen with an angle so that it only encompasses one singularity. If a function behave peculiarly nicely along $f(x+iy)$, you may be interested in the rectangular contour. A circular contour is especially useful for integrals of the form $\int_0^{2\pi}f(\sin(\theta))~\mathrm d\theta=\int_0^{2\pi}f(\cos(\theta))~\mathrm d\theta$.