My question contains the following example : Find the integral of $$\frac{x^3-x+4}{x^4-2x^3+2x^2-2x+1} = \frac{A}{x-1} + \frac{B}{(x-1)^2} + \frac{C x + D}{x^2+1}$$
So why is $B$ not multiplied by $x$ with another variable say $E$ because the denominator is also from a 2nd degree?
Notice that we have $$\frac{A}{x-1} + \frac{B}{(x-1)^2}$$ which is indeed $$\frac{Ax-A+B}{(x-1)^2}$$ which also can be written as $$\frac{Ex+F}{(x-1)^2}$$ by defining $E = A$ and $F = -A+B$.
Or we can change some of the definitions to get: $$\frac{A}{x-1} + \frac{Gx+H}{(x-1)^2} = \frac{(A+G)x+H-A}{(x-1)^2} = \frac{Ex+F}{(x-1)^2}$$ where we can define $E = A+G$ and $F = H-A$. These two should give same $E$ and $F$ in the end. But in this case, values for $A,G,H$ are not unique so I suggest you to use the first decomposition.