Integral of $\frac{1}{x^2+x+1}$ and$\frac{1}{x^2-x+1}$ How to integrate two very similar integrals. I am looking for the simplest approach to that, it cannot be sophisticated too much as level of the textbook this was taken from is not very high. $$\int \frac{1}{x^2+x+1} dx$$ and$$\int \frac{1}{x^2-x+1} dx$$

First recall that if $a,b,c$ are real numbers then $ax^2+bx+c$ can be factored using real numbers if and only if $b^2-4ac\ge 0$.  For your first polynomial above you have $a=b=c=1$ so $b^2-4ac=-3$, so you would need complex numbers to factor it.
Then recall that there is a standard technique in algebra for reducing a problem involving a quadratic polynomial with a first-degree term to a quadratic polynomial with no first degree term, namely completing the square.  You get
$$
x^2+x+1 = \left( x^2 + x + \frac 1 4 \right) + \frac 3 4 = \left( x + \frac 1 2 \right)^2 + \frac 3 4.
$$
Then you would like $\displaystyle \int \frac 1 {(\text{square})+1} \, dx$ so that you get an arctangent.  So write
$$
\left( x + \frac 1 2 \right)^2 + \frac 3 4 = \frac 3 4 \left( \left( \frac{2x+1}{\sqrt 3} \right)^2 + 1 \right) = \frac 3 4 (u^2 + 1) \quad\text{and}\quad dx = \frac{\sqrt 3} 2\, du.
$$
