It was said in DidMath No. 1/2024 at page 17 that the arctangent function bothers us in the calculation of integrals. Such a situation just arose in Problem 29046, author Mihály BENCZE, Brașov.
"29046 Let $a>1$. Determine $\int_{\frac{1}{a}}^a \frac{x^n\cdot \arctan x\;dx}{x^{2n+2}+x^{n+1}+1}\;.$"
ANSWER CiP
$$\frac{2\pi}{4(n+1)\sqrt{3}} \cdot \arctan \left( \frac{2}{\sqrt{3}} \cdot \frac {a^{2n+2}-1}{2a^{2n+2}+6a^{n+1}+1}\right )$$
Solution CiP
Lemma Let $a \neq 0,\;\Delta=b^2-4ac<0$. Then
$$\int \frac{1}{ax^2+bx+c}dx=\frac{2}{\sqrt{-\Delta}}\cdot \arctan\left ( \frac{2ax+b}{\sqrt{-\Delta}}\right )+C \tag{I}$$
Formula (I) can be verified with the definition, calculating for
$u=\frac{2}{\sqrt{-\Delta}}\cdot arctg \;\phi(x),\;\; \phi(x)=\frac{2ax+b}{\sqrt{-\Delta}}$
$$\frac {\mathrm{d}u}{\mathrm{d}x}=\frac{2}{\sqrt{-\Delta}}\cdot \frac{\phi^{'}}{\phi^2+1}=\frac{2}{\sqrt{-\Delta}}\cdot \frac{\frac{2a}{\sqrt{-\Delta}}}{\left ( \frac{2ax+b}{\sqrt{-\Delta}} \right ) ^2+1}=\frac{4a/(-\Delta)}{(4a^2x^2+4abx+b^2+4ac-b^2)/(-\Delta)}.$$
$\square$ end Lemma
For $a=1=b=c$ we obtain
Corollary $\int \frac{1}{x^2+x+1}dx=\frac{2}{\sqrt{3}} \cdot \arctan \left (\frac{2x+1}{\sqrt{3}} \right )+C \tag{1}$
Solving the problem:
We will not exaggerate with the claim to prove with derivatives that are equal the relationship
$$\arctan t +\arctan \frac{1}{t}=\frac{\pi}{2} \tag{2}$$
Let $I:=\int_{1/a}^{a} \frac{x^n \cdot \arctan x}{x^{2n+2}+x^{n+1}+1}dx$. With substitution
$$x=\frac{1}{t},\;\;dx=-\frac{1}{t^2}\cdot dt,\;\;\;t=a\;for \;x=\frac{1}{a},\;\;t=1/a\;for\; x=a\;\;\;\;\Rightarrow$$
$I=\int_{a}^{1/a}\frac {\frac{1}{t^n} \cdot \arctan\left( \frac{1}{t} \right)}{\frac{1}{t^{2n+2}}+\frac{1}{t^{n+1}+1} }\cdot \left ( -\frac{1}{t^2} \right ) dt\overset{(2)}{=}\int_{1/a}^{a} \frac {t^n \cdot (\pi /2-\arctan t)}{t^{2n+2}+t^{n+1}+1}dt=\frac{\pi}{2} \cdot \int_{1/a}^{a} \frac{t^n}{t^{2n+2}+t^{n+1}+1}dt-$
$-\int_{1/a}^{a}\frac{t^n \cdot \arctan t}{t^{2n+2}+t^{n+1}+1}dt=\frac{\pi}{2}\cdot \int_{1/a}^{a} \frac{t^n}{t^{2n+2}+t^{n+1}+1}-I\;\;\;\Rightarrow I+I=\frac{\pi}{2}\cdot \dots$, so
$$I=\frac{\pi}{4} \cdot \int_{1/a}^{a}\frac{t^n}{t^{2n+2}+t^{n+1}+1}dt \tag {3}$$
To the integral in (3) we make the substitution
$$t^{n+1}=u,\;\;t^n \cdot dt=\frac{du}{n+1},\;\;\;u=1/a^{n+1}\;for\;t=1/a,\;\;u=a^{n+1}\;for\;t=a\;\;\;(b:=a^{n+1})$$
and we have $I=\frac{\pi}{4} \cdot \int_{1/b}^{b} \frac{1}{u^2+u+1} \cdot \frac{du}{n+1}\overset{(1)}{=}\frac{\pi}{4(n+1)} \cdot \left ( \frac{2}{\sqrt{3}}\arctan (\frac{2u+1}{\sqrt{3}})\right)\Bigg\vert_{u=1/b}^{u=b}$
If we also consider the formula $\arctan t-\arctan s=\arctan\frac{t-s}{1+t\cdot s}$ then ve obtain
$I=\frac{2\pi}{4(n+1)\sqrt{3}} \cdot \left (\arctan \frac{2b+1}{\sqrt{3}}-\arctan \frac{2/b+1}{\sqrt{3}} \right )=\frac{2\pi}{4(n+1) \sqrt{3}} \cdot \arctan \left (\frac{2}{\sqrt{3}}\cdot \frac{b^2-1}{2b^2+6b+1} \right )$
and puttin $b=a^{n+1}$ we get the answer.
$\blacksquare$