How to find out the partial fraction decomposition form (or pattern ) of a rational function $\dfrac{P(X)}{Q(x)}$ , for example we know that the partial fraction decomposition form of $$\frac{x^{2}+3x+1}{(x-1)^{2}(x+3)},$$ would be something like this : $$\frac{A}{x-1}+\frac{B}{(x-1)^{2}}+\frac{C}{x+3}, \qquad A,B,C \in \mathbb{R}$$
but how did we "guess" that pattern ? and how to guess it in general case ?