Why do partial fractions sometimes switch the sign? According to my solution manual this a valid partial decomposition:
$$\frac1{(x^2-1)^2}=\frac A{x-1}+\frac B{(x-1)^2}+\frac C{x+1}+\frac D{(x+1)^2}$$
I'm not sure how I was supposed to know to flip the signs of the $1$ for $C$ and $D$? Is there some general rule I'm missing?
 A: The standard answer (as hinted at in the posted comment) is to note that $x^2-1=(x+1)(x-1)$, so the denominator is $\frac{1}{(x+1)^2(x-1)^2}$ then the rest follows by the usual rules for partial fractions. (Has nothing to do with "flipping signs", it just so happens that the factors of $x^2-1$ are $x \pm 1$.)
For an alternative shortcut, one could start with the relatively obvious:
$$
\frac{1}{x^2-1}=\frac{1}{2}\left(\frac{1}{x-1}-\frac{1}{x+1}\right)
$$
Then, squaring:
$$
\begin{align}
\frac{1}{(x^2-1)^2} &= \frac{1}{4}\left(\frac{1}{(x-1)^2}+\frac{1}{(x+1)^2} - \frac{2}{x^2-1}\right) \\
 &=\frac{1}{4} \left( \frac{1}{(x-1)^2} + \frac{1}{(x+1)^2}-\frac{1}{x-1}+\frac{1}{x+1}\right)
\end{align}
$$
A: You're not “flipping the signs”—you are using each of the factors of $x^2-1$.  In this case, they happen to be $x-1$ and $x+1$.
The partial fraction decomposition can be stated very generally.  But maybe it's best to illustrate with cases.  If the denominator were just $(x^2-1) = (x-1)(x+1)$, you would have each of those factors in a denominator:
$$
    \frac{1}{x^2-1} = \frac{1}{(x-1)(x+1)} = \frac{A}{x-1} + \frac{B}{x+1}
$$
This works for any product of distinct linear factors: just add one term for each factor, with a constant numerator.  It doesn't work for repeated factors, though.  In that case, you need to add one term to the PFD for each power of the repeated factor, up to the repeated power shown.  So:
\begin{align*}
    \frac{x}{(x-1)^2} &= \frac{A}{x-1} + \frac{B}{(x-1)^2} \\
    \frac{x}{(x-1)^3} &= \frac{A}{x-1} + \frac{B}{(x-1)^2} + \frac{C}{(x-1)^3}\\
\end{align*}
and so on.  The reason why is complicated, but basically you need enough independent constants to fit all possible numerators.
In your problem, $(x^2-1)^2$ factors as $(x-1)^2(x+1)^2$.  So we have to do the repeated-factor thing twice, once for $x-1$ and one for $x+1$.  Hence:
$$
    \frac{1}{(x^2-1)^2} = \frac{A}{x-1} + \frac{B}{(x-1)^2} + \frac{C}{x+1}+ \frac{D}{(x+1)^2}
$$
