To answer whis question we have to remember the factorization of sum of cubes
[tex]x^3+y^3=(x+y)(x^2-xy+y^2)[/tex]In this case y=1, then
[tex]\begin{gathered} x^3+1=x^3+1^3 \\ =(x+1)(x^2-1\cdot x+1^2) \\ =(x+1)(x^2-x+1) \end{gathered}[/tex]So that
[tex]\begin{gathered} \frac{x^3+1}{x+1}=\frac{(x+1)(x^2-x+1)}{x+1} \\ =x^2-x+1 \end{gathered}[/tex]Therefore the answer is D.