- Powers of linear factors in the denominator of a rational function indicate poles of higher order. Any rewriting of the original rational function as a sum of "simpler" rational functions (which is what partial fraction decomposition really is) would need to have a pole of the same order somewhere on the right hand side.
If you don't know what poles are, consider multiplying both sides with $(x+1)$ (no square). Then the left hand side is still unbounded near $x=-1,$ so the right hand side cannot have a finite limit there.
- One way to look at this is to note that $x^2+1$ is even, and there is no hope of rewriting a general function (odd+even parts) as a linear combination of even functions.
(update after clarification of question)
If you "arbitrarily" put a rational function like $\frac1{(x+1)^2(x-1)}$ equal to a linear combination of simple rational functions of your own choice, like in your first example, then you will obtain values for the coefficients but these are "necessary" and not "sufficient". If you work the result from your first example backwards then you obtain the rational function $\frac{x-2}{4(x-1)(x+1)^2}$ which is different from the original.
The general setting for this kind of trick is Bezout's theorem for polynomials: if $P(x)$ and $Q(x)$ have no common factors then there exist polynomials $A(x)$ and $B(x)$ such that $A(x)P(x)+B(x)Q(x)$ is the constant $1.$ Applying this to $P(x)=(x+1)^2$ and $Q(x)=x-1$ we see that we can write $\frac1{(x+1)^2(x-1)}=\frac{AP+BQ}{PQ}$ as a linear combination of $\frac1{(x+1)^2}$ and $\frac1{(x-1)}$ but the coefficients are polynomials the degrees of which can be chosen to be smaller than the degrees of the numerators, but not necessarily smaller than that. So instead of repeating the factor $(x+1)$ in the first degree you could also write the decomposition as
$$\frac1{(x+1)^2(x-1)}=\frac E{x-1}+\frac{Fx+G}{(x+1)^2}$$
As it turns out, the more usual form
$$\frac1{(x+1)^2(x-1)}=\frac A{x-1}+\frac{B}{x+1}+\frac{C}{(x+1)^2}$$
is "equivalent" to this in terms of getting a determined system of linear equations, but more "useful" when finding primitive functions (indefinite integrals).
convert(1 / ((x - 1) * (x + 1)^2), parfrac);
. – Travis Willse Jan 08 '16 at 00:35