<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] (Just working on the last integral, but not checking the partial fractions.)  Complete the square:
$$\int \frac{dx}{x^2+2x+5} = \int \frac{dx}{(x+1)^2 + 4}$$
Now, substitute $x+1 = 2\tan(t)$.  So, $dx = 2\sec^2 t\;dt$.  Thus:
$$\begin{align}
\int \frac{dx}{(x+1)^2 + 4} &= \int\frac{2\sec^2(t)dt}{4(\tan^2t + 1)} \\
&= \frac{1}{2}\int\frac{\sec^2 t\; dt}{\sec^2t} \\
&= \frac{1}{2}\int 1\; dt\\
&= \cdots
\end{align}$$
</s>