For this problem we'll use a very interesting result that derivative of (x+1)ex equals to (x+2)ex.
The given integral can be broken to use above result.
I=∫ex(x3−x2+2)(x2+1)2dx
=∫ex(x+2)(x2+1)−(x+1)(2x)(x2+1)2dx
=∫(xex+2ex)(x2+1)dx−∫2x(xex+ex)(x2+1)2dx
Using integration by parts and taking (xex+ex) as first and 2x(x2+1)2 as second function, we get:
I=∫(xex+2ex)(x2+1)dx−((xex+ex)∫2x(x2+1)2dx−∫ddx(xex+ex)∫2x(x2+1)2dxdx)
=∫(xex+2ex)(x2+1)dx−(xex+ex)(−1x2+1)+C+∫(xex+2ex)(−1x2+1)dx
=∫(xex+2ex)(x2+1)dx+(xex+ex)x2+1−∫(xex+2ex)(x2+1)dx+C
=ex(x+1)(x2+1)+C.
Hence the given integral equals to ex(x+1)(x2+1)+C.