Integration by substitution: $\displaystyle\int\frac{dx}{(1+x^2)^2}$ I came across this solution of a tricky integral using implicit substitution (i.e., manipulating differentials without actually declaring $u=\cdots$).
\begin{align*}
                \int \frac{dx}{(1+x^2)^2} &= \int \frac{1 + x^2 - x^2}{(1+x^2)^2}\,dx\\
                &= \int \frac{dx}{1+x^2} - \int \frac{x^2}{(1+x^2)^2}\,dx\\
                &=\tan^{-1}x - \frac{1}{2}\int \frac{x}{(1+x^2)^2}\,d(x^2+1)\\
                &= \tan^{-1}x+\frac 12\int x\, d\Big(\frac 1{1+x^2}\Big)\\
                &=\tan^{-1}x + \frac12\cdot \frac{x}{1+x^2}- \frac12\int \frac{dx}{1+x^2}\\
                &= \frac12\Big(\tan^{-1}x + \frac{x}{1+x^2}\Big)+c.
            \end{align*}
Can someone help me understand how to go from the third line to the fourth?  It doesn't seem like an obvious step. I'm guessing that it's because
$$d\Big(\frac 1{u(x)}\Big) = -\frac{d(u(x))}{u(x)^2},$$
but it doesn't seem like a natural next step, it's just the way I justified it to myself after already having seen the solution. Why should it be the next step?

Here's something you might like.
Writing the indefinite integral as a definite one and applying Feynman's method
\begin{align}I(a)&=\int_c^x\dfrac{1}{a^2+x^2}\,\mathrm dx=\dfrac1a\arctan\left(\dfrac xa\right)\bigg|_c^x=\dfrac1a\arctan\left(\dfrac xa\right)+C\\I'(a)&=\int_c^x-\dfrac{2a}{(a^2+x^2)^2}\,\mathrm dx=-\dfrac1{a^2}\arctan\left(\dfrac xa\right)-\dfrac x{a^2+x^2}+K\\-\dfrac1{2a}I'(a)&=\int_c^x\dfrac1{(a^2+x^2)^2}\,\mathrm dx=\dfrac1{2a^3}\arctan\left(\dfrac xa\right)+\dfrac1{2a(a^2+x^2)}+K\\-\dfrac12I'(1)&=\int_c^x\dfrac1{(1+x^2)^2}\,\mathrm dx=\dfrac12\arctan x+\dfrac1{2(1+x^2)}+K\end{align}
$$\boxed{\boxed{\int\dfrac1{(1+x^2)^2}\,\mathrm dx=\dfrac12\left[\arctan x+\dfrac1{1+x^2}+K\right]}}$$
where $C=\dfrac1a\arctan\left(\dfrac ca\right)$
