<s>[INST] Integrate by partial fraction decomposition $$\int\frac{5x^2+9x+16}{(x+1)(x^2+2x+5)}dx$$
Here's what I have so far...
$$\frac{5x^2+9x+16}{(x+1)(x^2+2x+5)} = \frac{\mathrm A}{x+1}+\frac{\mathrm Bx+\mathrm C}{x^2+2x+5}\\$$
$$5x^2 + 9x + 16 = \mathrm A(x^2+2x+5) + (\mathrm Bx+\mathrm C)(x+1)=\\$$
$$\mathrm A(x^2+2x+5) + \mathrm B(x^2+x)+\mathrm C(x+1)=\\$$
$$(\mathrm A+\mathrm B)x^2 + (2\mathrm A + \mathrm B + \mathrm C)x + (5\mathrm A+\mathrm C)\\$$
$$\mathrm A=-3,\;\mathrm B=8,\;\mathrm C = 31$$
$$$$
$$\int\frac{5x^2+9x+16}{(x+1)(x^2+2x+5)}dx = \int\bigg(-\frac{3}{x+1}+\frac{8x+31}{x^2+2x+5}\bigg)dx\Rightarrow$$
$$\int-\frac{3}{x+1}dx +\int\frac{8}{x^2+2x+5}dx+\int\frac{31}{x^2+2x+5}dx $$
Hopefully I've got it correct until this point (if not, someone point it out please!). I can do the first integration by moving the -3 out and using $u=x+1$ to get 
$$-3 \ln(x+1)$$
but I'm stuck on the next two.
 [/INST] It should be $A=3,B=2,C=1$ and you get:
$$\int \frac{3}{x+1} dx + \int \frac{2x+2}{x^2+2x+5} dx -\int \frac{1}{x^2+2x+5}dx$$
The second is easy by using $u=x^2+2x+5$ and other answerers have covered the last.
The key is writing $\frac{2x+1}{x^2+2x+5} = \frac{2x+2}{x^2+2x+5} - \frac{1}{x^2+2x+5}$.
It's probably easier to just set $u=x+1$ at the start. Then you get:
$$\int\frac{5(u-1)^2+9(u-1)+16}{u(u^2+4)}\,du=\int\frac{5u^2-u+12}{u(u^2+4)}dx$$
Then write:
$$\frac{5u^2-u+12}{u(u^2+4)} = \frac{A}{u} + \frac{Bu+C}{u^2+4}$$
Giving $$A=3,B=2,C=-1$$, and the integrals:
$$\int\left(\frac{3}{u} + \frac{2u}{u^2+4} - \frac{1}{u^2+4}\right)\,du$$
</s>