Solving the integral $\int_0^{\pi/2}\log\left(\frac{2+\sin2x}{2-\sin2x}\right)\mathrm dx$

$$J=\int_0^{\pi/2}\ln\left(\frac{2+\sin2x}{2-\sin2x}\right)\mathrm dx\overset{2x=t}=\frac12 \int_0^\pi \ln\left(\frac{1+\frac12\sin t}{1-\frac12\sin t}\right)\mathrm dt=\int_0^\frac{\pi}{2}\ln\left(\frac{1+\frac12\sin x}{1-\frac12\sin x }\right)\mathrm dx$$ Now let's consider the following integral: $$I(a)=\int_0^\frac{\pi}{2}\ln\left(\frac{1+\sin a\sin x}{1-\sin a\sin x}\right)dx\Rightarrow I'(a)=2\int_0^\frac{\pi}{2} \frac{\sin a\sin x}{1-\sin^2a\sin^2 x}dx$$ $$=\frac{2}{\sin a}\int_0^\frac{\pi}{2} \frac{\sin x}{\cos^2x +\cot^2 a}dx=\frac{2}{\sin a}\arctan\left(x\tan a\right)\bigg|_0^1=\frac{2a}{\sin a}$$ $$I(0)=0 \Rightarrow J=I\left(\frac{\pi}{6}\right)=2\int_0^\frac{\pi}{6}\frac{x}{\sin x}dx$$ $$=2\int_0^{\frac{\pi}{6}} x \left(\ln\left(\tan \frac{x}{2}\right)\right)'dx=2x \ln\left(\tan \frac{x}{2}\right)\bigg|_0^{\frac{\pi}{6}} -2{\int_0^{\frac{\pi}{6}} \ln\left(\tan \frac{x}{2}\right)dx}=$$ $$\overset{\frac{x}{2}=t}=\frac{\pi}{3}\ln(2-\sqrt 3) -4\int_0^\frac{\pi}{12}\ln (\tan t)dt=\frac{\pi}{3}\ln(2-\sqrt 3) +\frac{8}{3}G$$ $G$ is the Catalan's constant and for the last integral see here.


Also note that there's a small mistake. After integrating by parts you should have: $$2I=\frac{\pi^2}{4\sqrt 3}- \int_0^\infty\frac{(x^2-1)\arctan x}{x^4+x^2+1}dx=\frac{\pi^2}{4\sqrt 3}-\frac12\underbrace{\int_0^\infty \ln\bigg(\frac{x^2-x+1}{x^2+x+1}\bigg)\frac{dx}{1+x^2}}_{=J}$$


Result

I find that the integral has a closed form given by

$$i = \int\limits_0^{\pi/2}\log\bigg(\frac{2+\sin2x}{2-\sin2x}\bigg)\mathrm dx = \frac{1}{3} \left(8 C-\pi \log \left(2+\sqrt{3}\right)\right) \simeq 1.06346\tag{1}$$

where

$$C = \sum _{k=1}^{\infty } \frac{(-1)^{k+1}}{(2 k-1)^2} \simeq 0.915966$$

is Catalan's constant.

Heuristic derivation

Notice trivially that because of the symmtery of the integrand the integral can be written as twice the integral from $0$ to $\frac{\pi}{4}$ which we shall utilize in what follows.

The basic idea is the series expansion

$$\log \left(\frac{1+z}{1-z}\right)=2\tanh ^{-1}(z) = 2 \sum _{k=1}^{\infty } \frac{z^{2 k-1}}{2 k-1},|z|<1 \tag{2}$$

The integral is then to be done over the odd powers of the $\sin$ with the result

$$\int_0^{\frac{\pi }{4}} \sin ^{2 k-1}(2 x) \, dx = \frac{\sqrt{\pi } \Gamma (k)}{4 \Gamma \left(k+\frac{1}{2}\right)}\tag{3}$$

Assembling the pieces the sum to be taken to represent $i$ becomes

$$i_s = \sum _{k=1}^{\infty } \frac{\sqrt{\pi } \Gamma (k)}{(2 k-1) 2^{2 k-1} \Gamma \left(k+\frac{1}{2}\right)}\tag{4}$$

and this sum is immediately computed by Mathematica to give the compact result $(1)$.

Let us make the sum more transparent using the chain

$$\frac{\sqrt{\pi } \Gamma (k)}{\Gamma \left(k+\frac{1}{2}\right)}=B\left(\frac{1}{2},k\right)=\int_0^1 \frac{t^{k-1}}{\sqrt{1-t}} \, dt\tag{5}$$

and doing the sum under the integral

$$\sum _{k=1}^{\infty } \frac{t^{k-1}}{(2 k-1) 2^{2 k-1}}=\frac{\tanh ^{-1}\left(\frac{\sqrt{t}}{2}\right)}{\sqrt{t}}\tag{6}$$

leads finally to the integral

$$\int_0^1 \frac{\tanh ^{-1}\left(\frac{\sqrt{t}}{2}\right)}{\sqrt{t} \sqrt{1-t}} \, dt\tag{7}$$

for which Mathematica again quickly gives (1).

But there must be a shorter way ... yes, it is, substituting $\sin (2 x)=\sqrt{t}$ in the original integral gives (7) directly.


A Possible way: Consider $$I(a)=\int_{0}^{+\infty}\frac{\arctan(ax)}{1+x^2+x^4} dx$$ and $$I'(a)=\int_{0}^{+\infty}\frac{x}{(1+x^2+x^4)(1+x^2a^2)}dx=\int_{0}^{+\infty}\frac{1}{(1+y+y^2)(1+a^2y)}dx$$ and

$$\frac{1}{(1+y+y^2)(1+a^2y)}= \frac{-a^2y-a^2+1}{(a^4-a^2+1)(1+y+y^2)}+\frac{a^4}{(a^4-a^2+1)(ay^2+1)}$$

we can also calculate $I'(a)$ by complex integration (if you've learned that).

Thanks to Dylan for his advice.