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?

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}
$$
