The integration by parts formula is as follow-
$$ \int u\ dv = uv- \int v\ du$$
normally, I use L.I.A.T.E. As a guide for the priority of the choice of $u$
Where L is Log, I is inverse trigo, A is algebra, T is trigo, E is exponential.
The left side will be $u$ and right side will be $v$
Now, the question is $\int \tan^{-1} x\ dx$
What’s the product of 2 function here ?
In that question, I only see an inverse trigo function. $x$ cannot be counted as an algebra because x is part of the inverse trigo function.
so how do I pick $u$ ?
Take $u=\tan^{-1}(x)$ and $dv=dx$
$$du={dx\over x^2+1}$$
$$\int\tan^{-1}(x)dx=x\tan^{-1}(x)-\int{xdx \over x^2+1}$$
Now in the integral in the RHS substitute $w=x^2+1$ so $dw=2xdx$...