Example 5. Find $\int \frac{d x}{\left(x^{2}+a^{2}\right)^{n}}$, where $n \geqslant 2-$ an integer.
Solution. Let $I_{n}=\int \frac{d x}{\left(x^{2}+a^{2}\right)^{n}}$. Assuming that $n \geqslant 2$, we will integrate by parts another integral $I_{n-\mathrm{I}}$. We have:

$$
\begin{gathered}
I_{n-1}=\int \frac{d x}{\left(x^{2}+a^{2}\right)^{n-1}}=\left\{\begin{array}{c}
\frac{1}{\left(x^{2}+a^{2}\right)^{n-1}}=u, \quad d u=-\frac{2(n-1) x}{\left(x^{2}+a^{2}\right)^{n}} d x \\
d x=d v, \quad v=x
\end{array}\right\}= \\
=\frac{x}{\left(x^{2}+a^{2}\right)^{n-1}}+2(n-1) \int \frac{x^{2}+a^{2}-a^{2}}{\left(x^{2}+a^{2}\right)^{n}} d x= \\
=\frac{x}{\left(x^{2}+a^{2}\right)^{n-1}}+2(n-1) I_{n-1}-2(n-1) a^{2} I_{n}
\end{gathered}
$$

In the numerator of the fraction in the second-to-last equality, we added and subtracted $a^{2}$, represented the fraction as the difference of two fractions, and used the notation for the corresponding integrals. Solving the obtained equation for $I_{n}$, we express $I_{n}$ in terms of $I_{n-1}$ and a known expression:

$$
I_{n}=\frac{x}{2(n-1) a^{2}\left(x^{2}+a^{2}\right)^{n-1}}+\frac{2 n-3}{2(n-1) a^{2}} I_{n-1}
$$

Using this formula (it is called a recurrence formula), we will first determine $I_{2}$ (since the integral $I_{1}$ is known. $I_{1}=\int \frac{d x}{x^{2}+a^{2}}=$ $\left.=\frac{1}{a} \operatorname{arctg} \frac{x}{a}+C\right)$, then $I_{3}, I_{4}$, and so on. Rewrite the obtained result as

$$
\int \frac{d x}{\left(x^{2}+a^{2}\right)^{n}}=\frac{x}{2(n-1) a^{2}\left(x^{2}+a^{2}\right)^{n-1}}+\frac{2 n-3}{2(n-1) a^{2}} \int \frac{d x}{\left(x^{2}+a^{2}\right)^{n-1}}
$$

In particular,

$$
\int \frac{d x}{\left(x^{2}+a^{2}\right)^{2}}=\frac{1}{2 a^{2}\left(x^{2}+a^{2}\right)}+\frac{1}{2 a^{3}} \operatorname{arctg} \frac{x}{a}+C
$$