Evaluate $\int \frac{\left(x^2+x+3\right)\left(x^3+7\right)}{x+1}dx$.

If you do the substitution $x+1=t\iff x=t-1$ you only need do a (long) multiplication:

$$\int \frac{\left(x^2+x+3\right)\left(x^3+7\right)}{x+1}dx= \int \frac{\left((t-1)^2+t+2\right)\left((t-1)^3+7\right)}{t}dt= $$ $$=\int \frac{\left(t^2-t+3\right)\left(t^3-3t^2+3t+6\right)}{t}dt=\int \frac{t^5-4 t^4+9 t^3-6 t^2+3 t+18}{t}dt=$$ $$=\int\left( t^4-4 t^3+9 t^2-6 t+3 +\frac{18}{t}\right)dt $$ And now it's simple.


Horner's method for division:

$$(x^2+x+3)(x^3+7)=x^5+x^4+3x^3+7x^2+7x+21$$

\begin{array}{*{7}{r}} & 1 & 1 & 3 & 7 & 7 & 21 \\ + & \downarrow & -1 & 0 & -3 & -4 & -3 \\ \hline \times -1 & \color{red}1 & \color{red}0 & \color{red}3 & \color{red}4 & \color{red}3 & \color{cyan}{18} \end{array} so the quotient is $\;x^4+3x^2+4x+3$ and the remainder is $\;18$.


As substitution by parts goes nowhere It simply do what you did but skip the step of multiplying out the polynomial $ \frac{\left(x^2+x+3\right)\left(x^3+7\right)}{x+1}=\frac {(x(x+1) + 3)(x^3+7)}{x+1}= x(x^3 +7) + \frac 3{x+1}(x^3 + 7)=$

$x(x^3 +7) +\frac 3{x+1}(x^2(x+1) -x(x+1) + x+1 + 6)=x(x^3 +7) + 3(x^2-x+1) + \frac {18}{x+1} $

Saves one or two tablets of ibuprofen.