Simple integral: $\int \frac {1+r}{-r^2+r-1} dr$. I was solving a much longer exercise, and while solving an ODE, I got this integral $$\int \frac {1+r}{-r^2+r-1} dr$$
I think this must be pretty simple, but  I couldn't solve it, my substitutions didn't work and the polynomial in the denumerator does not have real roots, so partial frac. decomp. looks quite messy.
How are do you solve the general integral:
$$
\int \frac {r+a}{dr^2+er+f}dr
$$
When the denumerator has no real roots?

$r^2-r+1 = \frac{r^3+1}{r+1}$, hence $r^2-r+1=(r-\omega)(r-\omega^2)$, with $\omega=\exp\left(\frac{2\pi i}{6}\right)$.
By the residue theorem:
$$ \text{Res}\left(\frac{r+1}{r^2-r+1},r=\omega\right) = \frac{\omega+1}{2\omega},$$
$$ \text{Res}\left(\frac{r+1}{r^2-r+1},r=-\omega\right) = \frac{-\omega+1}{-2\omega},$$
hence the partial fraction decomposition is given by:
$$ \frac{r+1}{r^2-r+1} = \frac{1+\omega}{2\omega}\cdot\frac{1}{r-\omega}-\frac{1-\omega}{2\omega}\cdot\frac{1}{r+\omega}. $$
We may compute the primitive through the previous line, or through the trick:
$$ \frac{4r+4}{4r^2-4r+4} = \frac{1}{2}\frac{2r-1}{r^2-r+1}+\frac{2}{1+\frac{1}{3}(2r-1)^2}$$
that gives:
$$ \int \frac{r+1}{r^2-r+1}\,dr = \frac{1}{2}\log(r^2-r+1)+\sqrt{3}\arctan\left(\frac{2r-1}{\sqrt{3}}\right)+C.$$
