I need to integrate $\frac{1}{(x^2+2x+1)}$, so I need to use partial fraction as the polynomial can be factored as $\frac{1}{(x+1)^2}$. This is what I've tried:
$$\frac{A}{(x+1)} + \frac{B}{(x+1)^2}$$
$$A\cdot(x+1)^2 + B\cdot(x+1)$$
$$Ax^2+2Ax+A+Bx+B$$ $$Ax^2+(2A+B)x+(A+B)$$
So,
$$A=0$$ $$2A+B=0$$ $$A+B=1$$
but that does not make sense, because if $A=0$, then $2A+B$ can't be zero, could you please tell me what's the problem?
The fraction becomes $$ \frac{A}{(x+1)} + \frac{B}{(x+1)^2}= \frac{A(x+1)+B}{(x+1)^2}= \frac{Ax+(A+B)}{(x+1)^2} $$ so $A=0$ and $B=1$. Indeed $$ \frac{1}{(x+1)^2} $$ is already in “partial fractions” form. And $$ \int\frac{1}{(x+1)^2}\,dx=-\frac{1}{x+1}+C $$
It would be different if you started with $$ \frac{x}{(x+1)^2} $$ because then the decomposition would give $A=1$ and $B=-1$, so $$ \int\frac{x}{(x+1)^2}\,dx= \int\left(\frac{1}{x+1}-\frac{1}{(x+1)^2}\right)\,dx= \log|x+1|+\frac{1}{x+1}+C $$
Where's the problem with your computations? You have done $$ \frac{A}{(x+1)} + \frac{B}{(x+1)^2}= \frac{A(x+1)^2+B(x+1)}{(x+1)^3} $$ and then equalled this with $\frac{1}{(x+1)^2}$ without taking into account the different denominators.