<s>[INST] what is a smart way to find $\int \frac{\arctan\left(x\right)}{x^{2}}\,{\rm d}x$ I tried integration by parts, which gets very lengthy due to partial fractions.
Is there an alternative
 [/INST] Compute using the series expansion:
\begin{align*}
\int \frac{\tan^{-1} x}{x^2} dx &= \int \frac 1 {x^2} \left(x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots\right) dx \\
&= \int \frac 1 x - \frac{x}{3} + \frac{x^3}{5} - \cdots dx \\
&= \ln x - \frac{x^2}{2 \cdot 3} + \frac{x^4}{4 \cdot 5} - \frac{x^6}{6 \cdot 7} + \cdots
\end{align*}
Now using the identity
$$\frac 1 {n(n + 1)} = \frac 1 n - \frac 1 {n + 1}$$
we can rewrite the remaining series as
\begin{align*}
\frac{x^2}{2 \cdot 3} - \frac{x^4}{4 \cdot 5} + \frac{x^6}{6 \cdot 7} - \cdots &= \left(\frac{x^2}{2} - \frac{x^4}{4} + \frac{x^6}{6} - \cdots\right) -\left(\frac{x^2}{3} - \frac{x^4}{5} + \frac{x^6}{7}\right)
\end{align*}
These are both (related to) standard series for well-known functions; the second one is 
$$1-\frac {\tan^{-1} x} x$$
and the first is  $\frac 1 2\ln(x^2 + 1)$, using the fact that $$\ln(1 + t) = t - \frac {t^2}2 + \frac{t^3}3 - \frac{t^4}4 + \cdots$$
Putting all this together gives the result
$$\boxed{\displaystyle\int \frac{\tan^{-1} x}{x^2} dx = -\frac 1 2 \ln(1 + x^2) + \ln x - \frac{\tan^{-1} x}{x} + C}$$
</s>