$$\int \frac{x^4-16}{x^3+4x^2+8x}dx$$
So I first started with be dividing $p(x)$ with $q(x)$ and got:
$$\int x-4+\frac{8x^2+32x-16}{x^3+4x^2+8x}dx=\frac{x^2}{2}-4x+\int \frac{8x^2+32x-16}{x^3+4x^2+8x}dx$$
Using partial sum I have received:
$$\int \frac{8x^2+32x-16}{x^3+4x^2+8x}dx=8\int -\frac{1}{4x}+\frac{5x}{4(x^2+4x+8)}+\frac{5}{x^2+4x+8} dx=-2ln|x|+8(\frac{5}{4}\int\frac{x}{(x^2+4x+8)} +5\int \frac{1}{x^2+4x+8})=-2ln|x| +10\int\frac{x}{(x^2+4x+8)}dx +40\int \frac{1}{x^2+4x+8}dx$$
How do I continue from here?
You're almost there! Note that $$\frac{x}{x^2 + 4x + 8} =\frac{1}{2}\left( \frac{2x + 4 - 4}{x^2 + 4x + 8}\right) = \frac{1}{2}\left(\frac{2x + 4}{x^2 + 4x + 8}\right) - \frac{2}{x^2 + 4x + 8}$$
So that we have $$10\int\frac{x}{(x^2+4x+8)}dx +40\int \frac{1}{x^2+4x+8}dx = 5 \int \frac{2x + 4}{x^2 + 4x + 8} \, \mathrm{d}x + 20 \int \frac{\mathrm{d}x}{x^2 + 4x + 8}$$
which become a logarithmic and arctangent standard integral respectively.