When the integral of products is the product of integrals.
Why are we able to write the integral of products as the product of integrals here?
Assume you have two differentiable functions $f,g$ such that $$ f'+g'=f'\cdot g' \tag1 $$ by multiplying by $\displaystyle e^{f+g}$ one gets $$ (f'+g')\cdot e^{f+g}=\left(f'e^{f} \right)\cdot \left(g'e^{g} \right) \tag2 $$ then by integrating both sides $$ e^{f+g}=\int\left(f'e^{f} \right)\cdot \left(g'e^{g} \right) \tag3 $$ since $\displaystyle e^f=\int\left(f'e^{f} \right) $ and $\displaystyle e^g=\int\left(g'e^{g} \right)$ we have
$$ \int\left(f'e^{f} \right)\cdot \int\left(g'e^{g} \right) =\int\left(f'e^{f} \right)\cdot \left(g'e^{g} \right). \tag4 $$
By taking, $f'=-\dfrac1{x^2}$ and $g'=\dfrac1{1+x^2}$ we have $$ f'+g'=-\frac1{x^2}+\frac1{1+x^2}=-\frac1{x^2(1+x^2)}=f'g' $$ which leads to $(4)$ with the given example.
Let $F(x)$, $G(x)$ and $H(x)$ be antiderivatives of $f(x)$, $g(x)$ and $f(x) g(x)$ respectively. If $F(x) G(x) = H(x)$, then differentiating that equation gives us
$$ f(x) G(x) + F(x) g(x) = f(x) g(x) $$
or
$$ f(x) + F(x) \frac{g(x)}{G(x) - g(x)} = 0 $$
(assuming $G(x) \ne g(x)$). Given differentiable $G(x)$, with $g(x) = G'(x)$ and assuming $G(x) \ne g(x)$, you could get a suitable function $F(x)$ by solving the differential equation
$$ y'(x) + y(x) \frac{g(x)}{G(x) - g(x)} = 0$$
EDIT: In the case at hand we may take $g(x) = e^{\arctan(x)}/(x^2+1)$ and $G(x) = e^{\arctan(x)}$. The differential equation simplifies to $$ x^2 y'(x) + y(x) = 0 $$ which has the solutions $$ y(x) = C e^{1/x}$$ and (for $C=1$) this is your $F(x)$.