Proving $\int_0^\infty \log\left (1-2\frac{\cos 2\theta}{x^2}+\frac{1}{x^4} \right)dx =2\pi \sin \theta$

We start off by some $x\rightarrow \frac{1}{x}$ substitutions while derivating under the integral sign: $$I(\theta)=\int_0^\infty \log \left(1-2\frac{\cos 2\theta}{x^2}+\frac{1}{x^4} \right)dx\overset{x\rightarrow \frac{1}{x}}=\int_0^\infty \frac{\ln(1- 2\cos(2\theta) x^2 +x^4)}{x^2}dx$$ $$I'(\theta)=4\int_0^\infty \frac{\sin(2\theta)}{x^4-2\cos(2\theta)x^2+1}dx\overset{x\rightarrow \frac{1}{x}}=4\int_0^\infty \frac{\sin(2\theta)x^2}{x^4-2\cos(2\theta)x^2+1}dx$$ Now summing up the two integrals from above gives us: $$\Rightarrow 2I'(\theta)=4\int_0^\infty \frac{\sin(2\theta)(1+x^2)}{x^4-2\cos(2\theta)x^2+1}dx=4\int_0^\infty \frac{\sin(2\theta)\left(\frac{1}{x^2}+1\right)}{x^2+\frac{1}{x^2}-2\cos(2\theta)}dx$$ $$\Rightarrow I'(\theta)=2\int_0^\infty \frac{\sin(2\theta)\left(x-\frac{1}{x}\right)'}{\left(x-\frac{1}{x}\right)^2 +2(1-\cos(2\theta))}dx\overset{\large x- \frac{1}{x}=t}=2\int_{-\infty}^\infty \frac{\sin(2\theta)}{t^2 +4\sin^2 (\theta)}dt$$ $$=2 \frac{\sin(2\theta)}{2\sin(\theta)}\arctan\left(\frac{t}{2\sin(\theta)}\right)\bigg|_{-\infty}^\infty=2\cos(\theta) \cdot \pi$$ $$\Rightarrow I(\theta) = 2\pi \int \cos(\theta) d\theta =2\pi \sin \theta +C$$ But $I(0)=0$ (see J.G. answer), thus:$$I(0)=0+C\Rightarrow C=0 \Rightarrow \boxed{I(\theta)=2\pi\sin(\theta)}$$


For $\theta \in [0;\pi]$, \begin{align} J(\theta)&=\int_0^\infty \ln\left(1-\frac{2\cos(2\theta)}{x^2}+\frac{1}{x^4}\right) \,dx \end{align} Perform the change of variable $y=\dfrac{1}{x}$,

\begin{align} J(\theta)&=\int_0^\infty \frac{\ln\left(1-2\cos(2\theta)x^2+x^4\right)}{x^2} \,dx \end{align}

For $a\geq -1$, define the function $F$ by, \begin{align}F(a)&=\int_0^\infty \frac{\ln\left(1+2ax^2+x^4\right)}{x^2} \,dx\\ &=\left[-\frac{\ln\left(1+2ax^2+x^4\right)}{x}\right]_0^\infty+\int_0^\infty \frac{4\left(x^2+a\right)}{1+2ax^2+x^4}\,dx\\ &=\int_0^\infty \frac{4\left(x^2+a\right)}{1+2ax^2+x^4}\,dx\\ \end{align} Perform the change of variable $y=\dfrac{1}{x}$, \begin{align}F(a)&=\int_0^\infty \frac{4\left( \frac{1}{x^2}+a\right) }{x^2\left(1+\frac{2a}{x^2}+\frac{1}{x^4}\right) } \,dx\\ &=\int_0^\infty \frac{4\left( 1+ax^2\right) }{x^4+2ax^2+1 } \,dx\\ \end{align} Therefore, \begin{align}F(a)&=\int_0^\infty \frac{2(a+1)\left( 1+x^2\right) }{x^4+2ax^2+1 } \,dx\\ &=2(a+1)\int_0^\infty \frac{\left(1+\frac{1}{x^2}\right)}{x^2+\frac{1}{x^2}+2a } \,dx\\ &=2(a+1)\int_0^\infty \frac{\left(1+\frac{1}{x^2}\right)}{\left(x-\frac{1}{x}\right)^2+2(a+1) } \,dx\\ \end{align} Perform the change of variable $y=x-\dfrac{1}{x}$, \begin{align}F(a)&= 2(a+1)\int_{-\infty}^{+\infty}\frac{1}{x^2+2(a+1)}\,dx\\ &=4(a+1)\int_{0}^{+\infty}\frac{1}{x^2+2(a+1)}\,dx\\ &=\left[2\sqrt{2(a+1)}\arctan\left( \frac{x}{\sqrt{2(a+1)}} \right)\right]_0^\infty\\ &=\boxed{\pi\sqrt{2(1+a)}} \end{align}

Observe that, $J(\theta)=F\big(-\cos(2\theta)\big)$.

\begin{align} 2(1-\cos(2\theta))&=2(1-\cos^2(\theta)+\sin^2 (\theta))\\ &=2\times 2\sin^2 (\theta)\\ &=4\times \sin^2 (\theta)\\ \end{align} Since, for $\theta \in [0;\pi],\sin(\theta)\geq 0$ then $\sqrt{2(1-\cos(2\theta))}=2\sin(\theta)$

Therefore, \begin{align}\boxed{J(\theta)=2\pi \sin(\theta)}\end{align}


To complement Zacky's answer I'll add a proof that $I(0)=0$. Applying $x\mapsto\frac{1}{x}$ for $x\ge 1$ gives $$I(x)=2\int_0^\infty\ln|1-x^{-2}|dx=2\int_0^1\left[(1+\frac{1}{x^2})\ln(1-x^2)-2\ln x\right]\\=-2\int_0^1\left[(1+x^2)\sum_{n\ge 0}\frac{x^{2n}}{n+1}+2\ln x\right]dx=-2\int_0^1\left[\sum_{n\ge 0}\left(\frac{x^{2n}}{n+1}+\frac{x^{2n+2}}{n+1}\right)+2\ln x\right]dx\\=-2\left[\sum_{n\ge 0}\left(\frac{x^{2n+1}}{(n+1)(2n+1)}+\frac{x^{2n+3}}{(n+1)(2n+3)}\right)+2x\ln x-2x\right]_0^1\\=-2\left[\sum_{n\ge 0}\left(\frac{4}{(2n+1)(2n+3)}\right)-2\right],$$which vanishes by partial fractions.