Proving a formula for $\int_0^\infty \frac{\log(1+x^{4n})}{1+x^2}dx $ if $n=1,2,3,\cdots$ I came across the formula
$$\int_0^\infty \frac{\log \left(1+x^{4n} \right)}{1+x^2}dx = \pi \log \left\{2^n \prod_{k=1  ,\ k \text{ odd}}^{2n-1} \left(1+\sin \left( \frac{\pi k}{4n}\right) \right)\right\} $$
where $n=1,2,3,4,\cdots$
I checked it for a few values of $n$ and it seems to give correct results.
Please help me prove this result.
 A: Using parity, write the integral as $\frac12\int_{-\infty}^{\infty}$ and try to move the contour of integration to $i\infty$. The obstructions will be:


*

*A simple pole at $x=i$ which will produce the contribution
$$2\pi i \,\mathrm{res}_{z=i}\frac{\ln(1+x^{4n})}{1+x^2}=\pi\ln 2.\tag{1}$$

*$2n$ branch cuts $B_k$ (with $k=0,\ldots,2n-1$) emanating from the logarithmic branch points $x_k=\exp\left\{ i\pi\frac{1+2k}{4n}\right\}$. These will produce integrals of the logarithm jumps (all equal to $2\pi i$) over the branch cuts. These integrals will have the simplest form if the branch cuts are given by radial rays $B_k=[x_k,x_k\infty)$. Then \begin{align}\int_{B_k}=2\pi i\int_{x_k}^{x_k\infty}\frac{dx}{1+x^2}&=\pi \left[\ln\frac{1+ix}{1-ix}\right]_{x=x_k}^{x=x_k\infty}=\pi\left[i\pi-\ln\frac{1+i x_k}{1-ix_k}\right].
\end{align}
The sum of branch cut integrals can be transformed to
\begin{align}
\sum_{k=0}^{2n-1}\int_{B_k}=\pi\left[2\pi i n-\sum_{k=0}^{2n-1}\ln\frac{1+i x_k}{1-ix_k}\right]&=\pi\sum_{k=0}^{2n-1}\ln\left|\frac{1-i x_k}{1+ix_k}\right|=\\
&=\frac{\pi}{2}\sum_{k=0}^{2n-1}\ln\frac{1+\sin(\arg x_k)}{1-\sin(\arg x_k)}=\\
&=\pi\sum_{k=0}^{2n-1}\ln\frac{1+\sin(\arg x_k)}{|\cos(\arg x_k)|}=\\
&=\pi\ln \left(2^{2n-1}\prod_{k=0}^{2n-1}(1+\sin(\arg x_k))\right).\tag{2}
\end{align}
At the last step of obtaining (2), we needed to calculate the product
\begin{align}
P=\prod_{k=0}^{2n-1}\cos^2(\arg x_k)=2^{-4n}\prod_{k=0}^{2n-1}(x_k-\bar{x}_k)^2=
2^{-4n}\prod_{k=0}^{2n-1}\left(e^{\frac {i\pi} {2 n}} + e^{-\frac {i\pi k} {n}}\right)
\left(e^{-\frac {i\pi} {2 n}} + e^{\frac {i\pi k} {n}}\right).
\end{align}
But since $\displaystyle x^{2n}-1=\prod_{k=0}^{2n-1}\left(-x+e^{-\frac {i\pi k} {n}}\right)$, the products can be computed easily so that
$$P=2^{-4n}\left(e^{i\pi}-1\right)\left(e^{-i\pi}-1\right)=2^{2-4n}.$$
Summing (1) and (2) and taking into account the factor of $\frac12$, we obtain the following expression for the integral:
$$\int_0^{\infty}\frac{\ln(1+x^{4n})}{1+x^2}dx=\frac{\pi}{2}\ln \left(2^{2n}\prod_{k=0}^{2n-1}(1+\sin(\arg x_k))\right).$$
This is obviously equivalent to the quoted answer.

A: Evaluate
$J=\int_0^\infty\frac{\ln(1+x^{4n})}{1+x^2} \,dx $
with
$1+x^{4n} = \prod_{k=1}^{2n}(1+e^{i\pi\frac{2n+1-2k}{2n} }x^2)
$
and
$\int_0^\infty \frac{\ln(1+r x^2)}{1+x^2}dx= \pi\ln(1+r^{\frac12})
$
\begin{align}
J& =\int_0^\infty\frac{dx}{1+x^2} \sum_{k=1}^{2n}
\ln (1+e^{i\pi\frac{2n+1-2k}{2n} }x^2)
= \pi\sum_{k=1}^{2n} \ln (1+e^{i\pi\frac{2n+1-2k}{4n} })\\
 &=2\pi\sum_{k=1}^{n} \ln \left(2\cos\frac{(2n+1-2k)\pi}{8n} \right)
=2\pi\sum_{j=1,odd}^{2n-1} \ln \left(2\cos\frac{(2n-j)\pi}{8n}\right) \\
  &=\pi \sum_{j=1,odd}^{2n-1} \ln \left(4\cos^2\frac{(2n-j)\pi}{8n} \right)
=\pi \sum_{j=1,odd}^{2n-1} \ln \left(2(1+\sin\frac{\pi j}{4n} )\right)\\
& =\pi \ln \bigg( 2^n \prod_{j=1,odd}^{2n-1} \left(1+\sin \frac{\pi j}{4n}\right)\bigg)
\end{align}
