$\begingroup$

Let be $n\in \mathbb{Z_+}$.

Compute the following integral: $$\int \frac{1}{\left(x^2+1\right)^n}dx$$

I obtained that for $$n=1$$ the value of the integral is $$\tan^{-1}x+C$$ and for $$n=2$$ $$x\left(\frac{1}{2\left(x^2+1\right)}+\frac{\tan \:^{-1}}{2x}\right)+C$$ How to do the rest of the cases?