The integral is:
$$\frac{1}{2\pi} \int_{-\pi}^{\pi}\sin^2\left ( \frac{\theta_{k}}{2} \right )dk$$
where $$\theta_{k} = \arctan\left ( \frac{4\sin{k}}{4e^{J}\sin^2{k} + e^{J} - e^{-J}} \right )$$
Is it possible to analytically solve this through substitution to obtain a solution dependent on J? If so, how would I go about solving this? It should be worth noting that J is a constant.
Both mathematica and Python are struggling, unless I have coded wrong?
Firstly, one can see that the integrand is an even function, so the integral reduces to
$$ I = \frac{1}{\pi} \int_0^{\pi} \sin^2\left(\frac{1}{2}\arctan\left(\frac{4\sin k}{4e^J \sin^2 k + e^J - e^{-J}}\right)\right) $$
Define $X := \frac{4\sin k}{4e^J \sin^2 k + e^J - e^{-J}}$ and $T := \arctan(X)$. Then, $X = \tan(T)$ and so $\sin^2\left(\frac{1}{2}T\right) = \frac{1}{2}\left(1 - 2\cos(T)\right) = \frac{1}{2}\left(1 - \frac{2}{\sqrt{X^2 + 1}}\right)$ Therefore,
\begin{align*} I &= \frac{1}{\pi} \int_0^{\pi} \sin^2 \left(\frac{1}{2} T(X(k)) \right) dk \\ &= \frac{1}{2} - \frac{1}{\pi}\int_0^{\pi} \frac{1}{\sqrt{X^2 + 1}} dk \\ &= \frac{1}{2} - \frac{1}{\pi}I_0 \end{align*}
Next we tackle the integral (help me). We abstract the constants by writing $X := \frac{\sin k}{a\sin^2 k + b}$ instead, where $a = e^J$ and $b = \frac{1}{4}\left(a - a^{-1}\right)$. We also assume that $J > 0$, which means $a > 1$ and $b > 0$. Then,
$$ \begin{align*} I_0 &= \int_0^{\pi} \frac{1}{\sqrt{1 + \left(\frac{\sin k}{a\sin^2 k + b}\right)^2}} dk \\ &= \int_0^{\pi} \frac{1}{\sqrt{\frac{(a\sin^2 k + b)^2 + \sin^2 k}{(a\sin^2 k + b)^2}}} dk \\ &= \int_0^{\pi} \frac{a\sin k + b}{\sqrt{a^2\sin^4 k + (2ab + 1)\sin^2 k + b^2}} dk \end{align*} $$
Where in the final step, we actually used the fact that $a\sin^2 k + b > 0$ to allow extracting the square root. Finally, the final expression can be split into two integrals. The first one is $\int_0^{\pi} \frac{a\sin k}{\sqrt{a^2(1 - \cos^2 k)^2 + (2ab + 1)(1 - \cos^2 k) + b^2}} dk$, which after a substitution $t = \cos k$ and simplification gives something like $\int_{-1}^1 \frac{1}{\sqrt{t^4 + At^2 + B}} dt$, which I doubt has a closed form. The second integral is something similar except it's 50 times worse, and it seems that one might be able to write it in terms of elliptic integrals, but I am not bothered to do so. But this form should be enough for accurate numeric approximation.