How to calculate $\int \frac{dx}{(a^2 + x^2)^2}$? I'm trying to use a trig substitution but I'm stuck. Here's what I did so far: 
$$\int \frac{dx}{(a^2 + x^2)^2}$$
Let $x = a\sin \theta, dx = a\cos \theta d\theta$
$$\int \frac{a cos\theta d\theta}{(a^2 + a^2 sin^2 \theta)^2} = \int \frac{a\cos \theta d\theta}{(a^2(1+sin^2\theta))^2} $$
$$\int \frac{a\cos \theta d\theta}{(a^2 \cos^2\theta)^2} =\int \frac{d\theta}{a^3cos^3\theta}  $$
I don't know what to do anymore

This could be done in a "general" way. 
Denoting
$$
I_k=\int \frac{dx}{(x^2+a^2)^k},
$$
one has (for $k>1$)
$$
\begin{align}
I_k&=\frac{1}{a^2}\int\frac{(x^2+a^2)-x^2}{(x^2+a^2)^k}\ dx\\
&=\frac{1}{a^2} I_{k-1}-\frac{1}{a^2}\int\frac{x^2}{(x^2+a^2)^k}\ dx\\
&=\frac{1}{a^2} I_{k-1}+\frac{1}{2a^2(k-1)}\int x\ d\left(\frac{1}{(x^2+a^2)^{k-1}}\right)\\
&=\frac{1}{a^2} I_{k-1}+\frac{1}{2a^2(k-1)}\left[\frac{x}{(x^2+a^2)^{k-1}}-I_{k-1}\right],
\end{align}
$$
which gives 
$$
I_k=\frac{x}{2a^2(k-1)(x^2+a^2)^{k-1}}+\frac{2k-3}{2a^2(k-1)}I_{k-1}.
$$
Now you can get $I_2$ by observing that
$$
I_1=\frac{1}{a}\arctan\frac{x}{a}+C.
$$

 Notes: The recursive relation above allows one to calculate $I_k$ for any positive integer $k$ in principle, which can be used to calculate any indefinite integral of rational functions. 
