<s>[INST] Evaluation of $\int\frac{1}{\sin^2 x+\sin x+1}dx$ 
Evaluation of $\displaystyle \int\frac{1}{\sin^2 x+\sin x+1}dx$

$\bf{My\; Try::}$ Using $$\; \bullet\;  x^2+x+1 = (x-\omega)\cdot (x-\omega^2)\;,$$ where $\omega,\omega^2$ are cube root of unity
So we can write Integal $$\displaystyle I = \int\frac{1}{(\sin x-\omega)\cdot (\sin x-\omega^2)}dx$$
So we get  $$\displaystyle I = \frac{1}{\omega-\omega^2}\int\frac{(\sin x-\omega^2)-(\sin x-\omega)}{(\sin x-\omega)\cdot (\sin x-\omega^2)}dx$$
So $$\displaystyle I = \frac{1}{\omega-\omega^2}\int \left[\frac{1}{\sin x-\omega}-\frac{1}{\sin x-\omega^2}\right]dx$$
Now Substitute $$\displaystyle \sin x= \frac{2\tan \frac{x}{2}}{1+\tan^2 \frac{x}{2}}$$
Can we solve it above method our we directly put $$\displaystyle \sin x= \frac{2\tan \frac{x}{2}}{1+\tan^2 \frac{x}{2}}$$
in $$\displaystyle \int\frac{1}{\sin^2 x+\sin x+1}dx$$ and then solve it.
Or is there is any other process by which we can solve it.
Help me , Thanks
 [/INST] Substitute $y=\sec x - \tan x$, or $\sin x=\frac{1-y^2}{1+y^2}$
\begin{align}
&\int \frac{1}{\sin^2 x+\sin x+1}dx\\
=&-\int\frac{2+{2y^2}}{3+y^4}dy
= -\int\frac{\frac2{y^2}+{2}}{\frac3{y^2}+y^2}dy \\
=&\ \frac{\sqrt3+1}{\sqrt{6\sqrt3}}\tan^{-1}\frac{y-{\sqrt3}y^{-1}}{\sqrt{2\sqrt3}}
-\frac{\sqrt3-1}{\sqrt{6\sqrt3}}\coth^{-1}\frac{y+{\sqrt3}y^{-1}}{\sqrt{2\sqrt3}}\\
= &\ \frac{\sqrt3+1}{\sqrt{6\sqrt3}}\tan^{-1}\frac{(\sqrt3-1)\sec x+(\sqrt3+1)\tan x}{\sqrt{2\sqrt3}}\\
&+\frac{\sqrt3-1}{\sqrt{6\sqrt3}}\coth^{-1}\frac{(\sqrt3+1)\sec x+(\sqrt3-1)\tan x}{\sqrt{2\sqrt3}}+C\\
\end{align}
which leads to the definite integral below
\begin{align}
 &\int_{-\frac\pi2}^{\frac\pi2} \frac{dx}{\sin^2 x+\sin x+1}
=\frac\pi3 \sqrt{3+2\sqrt3}
\end{align}
</s>