$\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.
 A: Apply Integral Substitution: $\color{blue}{u=\tan \left(\frac{x}{2}\right)\quad \:dx=\frac{2}{1+u^2}du}$
$$\int \frac{\cos \left(x\right)}{\left(1+\cos \left(x\right)\right)^3}dx=\int \frac{1}{4}\left(1-u^4\right)du$$
A: Hint. By the change of variable that you have performed, one just gets
$$
\int \frac{\cos x}{(1+\cos x)^3}dx=\int\frac{\frac{1-t^2}{1+t^2}}{(1+\frac{1-t^2}{1+t^2})^3}\frac{2}{1+t^2}dt=\int(1-t^4)\:dt
$$ Can you take it from here?
A: 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.
A: $$
\frac{\frac{1-t^2}{1+t^2}}{ \left(1+\frac{1-t^2}{1+t^2}\right)^3}\frac{2}{1+t^2}
$$
Start by multiplying the top and bottom of the expression above both by the common denominator $(1+t^2)^3$. The factor
$$
\frac{\frac{1-t^2}{1+t^2}}{1+t^2}
$$
becomes
$$
(1-t^2)(1+t^2).
$$
The factor
$$
\left( 1+ \frac{1-t^2}{1+t^2} \right)^3
$$
in the denominator becomes
$$
\Big( (1+t^2) + (1-t^2) \Big)
$$
and then simplifies to $2$.  You end up with
$$
\int \frac{(1-t^2)(1+t^2)} 2 \, dt = \int (1-t^4)\,dt.
$$
