<s>[INST] How to simplify the integration? If any integration is in form $$\int \frac{1}{1+x^2}dx$$ it easily follows the $\tan^{-1}x$ but How to simplify if we have
$$\int \frac{1}{(1+x^2)^2}dx$$
 [/INST] An idea that works for $\frac{1}{(1+x^2)^2}$ and for all other exponents $\frac{1}{(1+x^2)^n}$ is to get the base of the denominator in the numerator
$$\frac{1}{(1+x^2)^2}=\frac{1+x^2}{(1+x^2)^2}-\frac{x^2}{(1+x^2)}$$
The integral of the first term we know because it has a lower exponent and for the second we can write it as $$\frac{1}{2}x\frac{2x}{(1+x)^2}$$ and integrate by parts
$$\frac{1}{2}\int x\frac{2x}{(1+x^2)^2}=\frac{1}{2}x\frac{1}{(1+x^2)}+\frac{1}{2}\int\frac{1}{(1+x^2)}$$
which makes it boil down again to the integral with the smaller exponent, which we know.
Adding the two parts we get the answer $$\arctan(x)-\frac{1}{2}x\frac{1}{(1+x^2)}-\frac{1}{2}\arctan(x)=\frac{1}{2}\arctan(x)-\frac{1}{2}x\frac{1}{(1+x^2)}$$
</s>