If you compute the integral:
$$ \int \frac{2x}{(x+1)^2}.$$ by substitution (using $u=x+1$, then you
will get.
$$ 2 \ln | 1 + x | + \frac{2}{1+x} + C.$$
But if, instead, you use integration by parts: $u=x, dv=2/(1+x)^2$, you will get
$$ -\frac{2x}{1+x} + 2 \ln | 1 +x | + C .$$
Clearly $C$ cannot depend on $x$. The two results should be the same.
Why are they different?