<s>[INST] $\int \frac{\cos(x)}{(1+\cos(x))^3} \, dx$? I'm having a bit of a trouble seeing how to factorize the result of substituting $t=\tan(x/2)$, $\cos(x)=\frac{1-t^2}{1+t^2}$ and $dx=\frac{2}{1+t^2} \, dt$ into
$$\int \frac{\cos(x)}{(1+\cos(x))^3} \, dx$$
The result is
$$\int\frac{\frac{1-t^2}{1+t^2}}{(1+\frac{1-t^2}{1+t^2})^3}\frac{2}{1+t^2} \, dt$$ 
that looks horrible.
 [/INST] Focus on the rightmost factor. Multiply the numerator by it, and bring the $2$ outside the integral.
$$\int\frac{\frac{1-t^2}{1+t^2}}{(1+\frac{1-t^2}{1+t^2})^3}\color{red}{\frac{2}{1+t^2}} \, dt = \color{red}{2}\int\frac{\frac{1-t^2}{\color{red}{(1+t^2)^2}}}{(1+\frac{1-t^2}{1+t^2})^3} \, dt$$
Focus on the denominator. For $1$ and $\frac{1-t^2}{1+t^2}$ make a common denonimator of $1+t^2$.
$$2\int\frac{\frac{1-t^2}{(1+t^2)^2}}{(\color{red}{1+\frac{1-t^2}{1+t^2}})^3} \, dt = 2\int\frac{\frac{1-t^2}{(1+t^2)^2}}{(\color{red}{\frac{2}{1+t^2}})^3} \, dt$$
Simplify the fraction. 
$$2\int\frac{1-t^2}{(1+t^2)^2}\frac{(1+t^2)^3}{8} \, dt = \frac14\int(1-t^2)(1+t^2) \, dt = \frac14\int(1-t^4) \, dt$$
To be explicit, in the above line we (1) cube the denominator, and (2) multiply the numerator of the fraction by the reciprocal of the denominator. (3) factor the $\frac18$ to the front, and (4) cancel like terms. Finally, for the final equality, (5) distribute like terms.
</s>