Evaluate the following integral:
$\int \frac{1}{(x+1)^{2}\left(x^{2}+1\right)} d x$
$I=\frac{1}{(x+1)^{2}\left(x^{2}+1\right)}$
$\frac{1}{(x+1)^{2}\left(x^{2}+1\right)}=\frac{A}{x+1}+\frac{B}{(x+1)^{2}}+\frac{C x+D}{x^{2}+1}$
$1=A(x+1)\left(x^{2}+1\right)+B\left(x^{2}+1\right)+(C x+D)(x+1)^{2}$
$=A x^{3}+A x^{2}+A x+A+B x^{2}+B+C x^{3}+2 C x^{2}+C x+D x^{2}+2 D+D$
$=(A+C) x^{3}+(A+B+2 C+D) x^{2}+(A+C+2 D) x+(A+B+D)$
Equating constants
$1=A+B+D$
Equating coefficients of $x^{3}$
$0=A+C$
Equating coefficients of $x^{2}$
$0=A+B+2 C+D$
Equating coefficients of $x$
$0=A+C+2 D$
Solving we get
$A=\frac{1}{2} B=\frac{1}{2} C=-\frac{1}{2} D=0$
Thus,
$I=\frac{1}{2} \int \frac{\mathrm{dx}}{\mathrm{x}+1}+\frac{1}{2} \int \frac{\mathrm{dx}}{(\mathrm{x}+1)^{2}}-\frac{1}{2} \int \frac{\mathrm{dx}}{\mathrm{x}^{2}+1}$
$I=\frac{1}{2} \log |\mathrm{x}+1|-\frac{1}{2(\mathrm{x}+1)}-\frac{1}{4} \log \left|\mathrm{x}^{2}+1\right|+\mathrm{C}$