Rational Integral
1. **State the problem:** We want to find the indefinite integral $$\int \frac{2x^3 + 1}{x^2 + x + 1} \, dx.$$\n\n2. **Understand the problem:** The integrand is a rational function where the numerator's degree (3) is higher than the denominator's degree (2). We should first perform polynomial division to simplify the integrand.\n\n3. **Polynomial division:** Divide $2x^3 + 1$ by $x^2 + x + 1$.\n\n- Divide the leading terms: $\frac{2x^3}{x^2} = 2x$.\n- Multiply divisor by $2x$: $2x(x^2 + x + 1) = 2x^3 + 2x^2 + 2x$.\n- Subtract: $(2x^3 + 1) - (2x^3 + 2x^2 + 2x) = -2x^2 - 2x + 1$.\n\n4. **Rewrite the integral:**\n$$\int \frac{2x^3 + 1}{x^2 + x + 1} \, dx = \int \left(2x + \frac{-2x^2 - 2x + 1}{x^2 + x + 1}\right) dx.$$\n\n5. **Split the integral:**\n$$\int 2x \, dx + \int \frac{-2x^2 - 2x + 1}{x^2 + x + 1} \, dx.$$\n\n6. **Integrate the first part:**\n$$\int 2x \, dx = x^2 + C.$$\n\n7. **Simplify the second integral:** Let\n$$I = \int \frac{-2x^2 - 2x + 1}{x^2 + x + 1} \, dx.$$\n\nRewrite numerator to relate to denominator:\n$$-2x^2 - 2x + 1 = -2(x^2 + x + 1) + 3.$$\n\nSo,\n$$I = \int \frac{-2(x^2 + x + 1) + 3}{x^2 + x + 1} \, dx = \int \left(-2 + \frac{3}{x^2 + x + 1}\right) dx = \int -2 \, dx + 3 \int \frac{1}{x^2 + x + 1} \, dx.$$\n\n8. **Integrate the constant term:**\n$$\int -2 \, dx = -2x + C.$$\n\n9. **Complete the square in denominator:**\n$$x^2 + x + 1 = \left(x + \frac{1}{2}\right)^2 + \frac{3}{4}.$$\n\n10. **Use substitution for the integral:** Let\n$$u = x + \frac{1}{2},$$\nthen\n$$I_2 = \int \frac{1}{u^2 + \left(\frac{\sqrt{3}}{2}\right)^2} \, du = \frac{2}{\sqrt{3}} \arctan \left( \frac{2u}{\sqrt{3}} \right) + C.$$\n\n11. **Combine all parts:**\n$$\int \frac{2x^3 + 1}{x^2 + x + 1} \, dx = x^2 - 2x + 3 \cdot \frac{2}{\sqrt{3}} \arctan \left( \frac{2x + 1}{\sqrt{3}} \right) + C = x^2 - 2x + \frac{6}{\sqrt{3}} \arctan \left( \frac{2x + 1}{\sqrt{3}} \right) + C.$$\n\n**Final answer:**\n$$\boxed{\int \frac{2x^3 + 1}{x^2 + x + 1} \, dx = x^2 - 2x + \frac{6}{\sqrt{3}} \arctan \left( \frac{2x + 1}{\sqrt{3}} \right) + C}.$$