Partial fraction decomposition of type $1/(x^2+k)$ I know that partial fraction of this can be written as:
$$\frac{3x}{(1+x)(2+x)}=\frac{-3}{1+x}+\frac{6}{2+x}$$
Which can be done in these ways:
$$\frac{3x}{(1+x)(2+x)}=\frac{A}{1+x}+\frac{B}{2+x}\implies3x=A(2+x)+B(1+x),\forall\;x$$
And now solving it to get A and B.Also someone told me that write the fraction without that denominator whose coeffecient you want to know and put root of denominator, for e.g.:
$$\text{coefficient of $1/(1+x)$ i.e. A}=\frac{3x}{2+x}|_{x+1=0\implies x=-1}=\frac{-3}{1}$$
I know that this is just the first way disguised in an easy form, now what when I need to decompose:
$$\frac1{(x-3)(x^2-1)}\text{ or }\frac1{(x-3)(x^2+1)}$$
There exist multiple root of first and root to second doesn't exist. 
Now what to do, adopt the first method? Is there any easy method for these?
 A: Decomposing $1/(x+n)(x^2 + k)$ is only difficult (for me) when k is a positive quantity. Otherwise just use $a^2 - b^2$. For example:
$$\frac1{(x-3)(x^2-1)} = \frac1{(x-3)(x-1)(x+1)} = \frac{A}{x-3} + \frac{B}{x-1} + \frac{C}{x+1}$$
Here,
$$A = \frac1{(3-1)(3+1)} = \frac1{8}\\
B = \frac1{(1-3)(1+1)} =\frac{-1}{4} \\
C = \frac1{(-1-3)(-1-1)} = \frac{1}{8}$$

Now, for the guy I don't like:
$$\frac{1}{(x^2 +1)(x-3)} = \frac{Ax+B}{x^2 +1} + \frac{C}{x-3}$$

Try some easy values of $x$, I'll take $x=0$,
$$ B + \frac{C}{3} = \frac{-1}{3} \quad\dots(1)$$
Now, I'll take $x= 1$,
$$\frac{A + B}{2} - \frac{C}{2} = -\frac{1}{4} \quad\dots(2)$$
Let $x=2$,
$$\frac{2A + B}{5} - C= -\frac1{5}\quad\dots(3)$$ 
Solving $(1)$ and $(2)$ and $(3)$, we get
$$A = -\frac{1}{10},\, B = -\frac{3}{10},\, C = \frac{1}{10} $$ 

This is the easiest (and only) method I know to find partial fractions and it helps me immensely in indefinite integration.
A: These are two different beasts, at least on the reals. First, $$\frac1{(x-3)(x^2-1)}=\frac{a}{x-3}+\frac{b}{x-1}+\frac{c}{x+1},$$ for some suitable real numbers $(a,b,c)$. Second, on the reals, $$\frac1{(x-3)(x^2+1)}=\frac{A}{x-3}+\frac{Bx+C}{x^2+1},$$  for some suitable real numbers $(A,B,C)$. But, on the complex numbers, $$\frac1{(x-3)(x^2+1)}=\frac{D}{x-3}+\frac{E}{x+\mathrm i}+\frac{F}{x-\mathrm i}.$$ for some suitable complex numbers $(D,E,F)$. Naturally, $(D,E,F)$ is related to $(A,B,C)$ since $$D=A,\quad E+F=B,\quad \mathrm i\,(F-E)=C,$$ which is enough to show that $D$ is real and that $F=\bar E$ with $E=\frac12(B+\mathrm i\,C)$ and $F=\frac12(B-\mathrm i\,C)$.
Recall that, in full generality, every polynomial on the reals is the product of some factors $(x-a)^n$ and $(x^2+bx+c)^m$ with $b^2\lt4c$ hence every rational fraction with denominator $$\prod_{k}(x-a_k)^{n_k}\cdot\prod_\ell(x^2+b_\ell x+c_\ell)^{m_\ell}$$ is the sum of a polynomial and of some terms $$\frac{A_{k,p}}{(x-a_k)^p}\qquad\text{and}\qquad\frac{B_{\ell,q}x+C_{\ell,q}}{(x^2+b_kx+c_k)^q},$$ for each $k$ and $\ell$, with $1\leqslant p\leqslant n_k$ and $1\leqslant q\leqslant m_\ell$, respectively.
