Help solving $\int {\frac{8x^4+15x^3+16x^2+22x+4}{x(x+1)^2(x^2+2)}dx}$ $\displaystyle\int {\frac{8x^4+15x^3+16x^2+22x+4}{x(x+1)^2(x^2+2)}\,\mathrm{d}x}$
I used partial fractions, solved $A = 2, C = 3$.

$$\frac{A}{x} + \frac{B}{x+1} + \frac{C}{(x+1)^2} +\frac{(Dx+E)}{(x^2+2)}$$
\begin{align*}
&8x^4+15x^3+16x^2+22x+4\\
&\quad = A(x+1)^2(x^2+2)+B(x)(x+1)(x^2+2)+C(x)(x^2+2)+(Dx+E)(x)(x+1)^2
\end{align*}
Substitute in $x=0$ to get $4=A(1)(2)$, so  $A = 2$
$$6x^4+11x^3+10x^2+14x = B(x)(x+1)(x^2+2)+C(x)(x^2+2)+(Dx+E)(x)(x+1)^2$$
Substitute in $x=-1$ to get
$$6-11+10-14 = C(-1)(1+2)$$
so $-9=-3C$, thus $C=3$.
Leaving me what I have below:

Which brings me to where I am currently stuck.
$$6x^4 +8x^3 +10x^2+8x = B(x)(x+1)(x^2+2) + (Dx + E) (x) (x+1)^2$$
Is the next best move to use substitution to solve for $B$?
 A: Given what you have, what happens when you set $x = -1$?
A: Below I show how the Heaviside cover-up method generalizes to handle nonlinear denominators. With numerator $\rm\:f(x)\ =\ 8x^4+15x^3+16x^2+22x+4\:,\: $ the undetermined partial fraction is
$$\rm\frac{f(x)}{x(x+1)^2(x^2+2)}\ =\ \frac{a}{x}\, + \,\frac{b\, (x+1) + c}{(x+1)^2}\, + \,\frac{d\, x+e}{x^2+2}$$
To find $\,\rm d\,x+e\,$ in the $\rm\: x^2+2\ $ fraction, clear denominators and collect factors of $\rm\: x^2 + 2\: $
$$\rm f(x)\ \ =\ \ x\ (x+1)^2\ (d\, x +\: e)\, +\, (x^2+2)\ g(x)\ ,\quad some\ \ g(x) \in \mathbb Q[x]$$
Evaluating this $\rm\bmod\, x^2 + 2,\ $ i.e.$\:$ iteratively applying the rewrite rule $\rm\ x^2 \to -2\,\ $ yields
$$\rm - 8\, x + 4\ =\: -(4\, d + e)\, x\, +\, 2\, d - 4\, e\ \iff \ d=2,\ e=0 $$
Notice this method amounts to ignoring ("covering") all the undetermined partial fractions having denominator different (i.e. coprime) from the current denominator $\rm\:p(x) = x^2+2\:$ (i.e. having different roots) then evaluating what remains at the roots of $\rm\,p(x)\,$ or,  equivalently,  evaluating it $\rm\bmod p(x).\,$ To avoid computing inverses $\rm\bmod p(x)\:$ we scale to clear denominators before evaluating. This is simply the higher-degree analog of the classical Heaviside method - where covering up and evaluating at $\rm\: x = r\:$ is equivalent to evaluating modulo $\rm\:x-r\:$.
Using the same method we can solve for the numerator of the $\rm\ (x+1)^2\,$ fraction
$$\rm f(x)\  =\  x\, (x^2+2)\, (b\, (x+1) + c)\,  + \, (x+1)^2\ h(x)\ ,\quad some\ \ h(x) \in\mathbb Q[x]$$
Evaluating it mod $\rm\, (x+1)^2,\, $ i.e.  iteratively applying rewrite rule $\rm\, x^2 \to\, -2\ x - 1\, $ yields
$$\rm 3\ x - 6\ =\ (5\, c - 3\, b)\, x\, +\, 2\, c - 3\, b\ \iff\ c = 3,\ b = 4 $$
A: First, I trust you used the correct partial fraction decomposition:
$$\frac{8x^4+15x^3+16x^2+22x+4}{x(x+1)^2(x^2+2)} = \frac{A}{x} + \frac{B}{x+1} + \frac{C}{(x+1)^2} + \frac{Dx+E}{x^2+2}.$$
This leads to
\begin{align*}
&8x^4 + 15x^3 + 16x^2 + 22x + 4\\
&\qquad = A(x+1)^2(x^2+2) + Bx(x+1)(x^2+2) + Cx(x^2+2) + (Dx+E)x(x+1)^2.
\end{align*}
A useful "trick" is to evaluate at the zeros of the linear factors to get some information; I suspect you evaluated at $x=0$ to get $2A = 4$, from which you got $A=2$. 
You can then evaluate at $x=-1$ to get $-3C = -9$, which is how you got $C=3$. Looking good. 
Then you used that to simplify.
$$2(x^2+2x+1)(x^2+2) +3x(x^2+2) = 2x^4 + 7x^3 + 6x^2 + 14x + 4,$$
which subtracted from $8x^4 + 15x^3 + 16x^2 + 22x + 4$ gave you
$$6x^4 + 8x^3 + 10x^2 + 8x = Bx(x+1)(x^2+2) + (Dx+E)x(x+1)^2.$$
Hmmm... Which is not quite what you have. Did you use the correct decomposition, or did you forget about being careful with that $(x+1)^2$?
Anyway: here's where you go stuck because you are used to being able to solve the partial fractions problems using only the evaluation trick. But when you have irreducible quadratic factors or powers of linear factors (or worse, both), the trick doesn't get you all the way there.
Here, we can factor out $x$ from both sides to get
$$6x^3 + 8x^2 + 10x + 8 = B(x+1)(x^2+2) + (Dx+E)(x+1)^2.$$
(We factored out $x$ from both sides and cancelled; that's how we dropped from fourth power to cube).
Edit.
We can further factor out $x+1$ from both sides:
$$(x+1)(6x^2 + 2x + 8) = (x+1)(B(x^2+2) + (Dx+E)(x+1))$$
to get
$$6x^2 + 2x + 8 = B(x^2+2) + (Dx+E)(x+1).$$
Contrary to your claim before, now that we had all the right terms, we cannot simply conclude that $D=6$, because there are two quadratic terms: $Bx^2$ and $Dx^2$. 
You can, however, evaluate at $x=-1$ to get $12 = 3B$, or $B=4$; from this you go to
$$6x^2 + 2x + 8 = 4x^2 + 8 + (Dx+E)(x+1)$$
or 
$$2x^2 + 2x = (Dx+E)(x+1).$$
Noting that the constant term on the right is $E$, and $0$ on the left, you get $E=0$. This gives
$$2x(x+1) = Dx(x+1)$$
which, cancelling $x(x+1)$ yields $D=2$.
Alternatively, from $2x^2+2x = (Dx+E)(x+1)$, we can factor the left hand side completely to get
$$2x(x+1) = (Dx+E)(x+1)$$
from which we immediately get $Dx+E = 2x$, so $D=2$ and $E=0$.
So, in summary, $A=2$, $B=4$, $C=3$, $D=2$, $E=0$. 
A: Following your original method from the point where you pose your question, here are a couple of tricks you can use, which were not mentioned in previous answers. (1) Set $x=\varepsilon -1$ and neglect $\varepsilon^2$, to get $B=4$ immediately. (2) Set $x=\mathrm{i}\sqrt2$ and equate real and imaginary parts to find $D$ and$E$ (independently of $B$). 
A: For kicks, I thought I provide the end result for checking:
${\huge{\displaystyle\int}} \! \dfrac {\rm{8x^4+15x^3+16x^2+22x+4}}{\rm{x(x+1)^{2}(x^2+2)}}~\mathrm{dx}~=~
{\huge{\displaystyle\int}} \! \dfrac {\rm{A}}{\rm{x}}+\dfrac {\rm B}{(\rm x+1)}+\dfrac {\rm C}{(\rm{x+1)^{2}}}+\dfrac {\rm{Dx+E}}{{\rm{(x^2+2)}}}~\mathrm{dx} $
$~~~~~~~~~~~~~~~
\left[ \begin{array}{ccccc}
\rm{a} \\
\rm{b} \\
\rm{c} \\
\rm{d} \\
\rm{e}
\end{array} \right] = \left[ \begin{array}{ccccc}
\rm{2} \\
\rm{4} \\
\rm{3} \\
\rm{2} \\
\rm{0}
\end{array} \right]~~~~~~~~~~\Rightarrow~~~~~~~~~~~~~~
={\huge{\displaystyle\int}} \! \dfrac {\rm 2}{\rm x}+\dfrac {\rm 4}{{\rm{(x+1)}}}+\dfrac {\rm 3}{{\rm{(x+1)^{2}}}}+\dfrac {\rm 2x+0}{{\rm{(x^2+2)}}}~\mathrm{dx}
$
$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
={\rm{2\ln|x|-4\ln(x+1)+\dfrac {3}{x+1}+\ln(x^2+2)+K}} 
$
$~~~~~~~~~~~\Big({\rm{\ln|x^2+2|\equiv \ln(x^2+2)}}~,~\because {\rm{x^2+2\gt 0~~\forall ~x \in \mathbb{R}}}\Big); ~$ 
via a substitution of the denominator for the last 3 integrals.
