<s>[INST] A parameterized log-sine integral equating to square of arctan I have a really convoluted proof of the following:
$$ (1) \quad \quad - \int_0^\pi \frac{\sin(2  y) \log(\sin (y/2)) } {r + 1/r + 2 \cos{(2  y)} } dy = \big(\arctan(\sqrt{r})\big)^2 $$
I proved it for $0<r<1.$  To my surprise it holds for complex $r$ if $-1<\Re{(r)}<1.$  Numerically it holds that 
$$ - \int_0^\pi \frac{\sin(2  y) \log(\sin (y/2)) } {r + 1/r + 2 \cos{(2  y)} } dy = \big(\text{arccot}(\sqrt{r})\big)^2 $$
if $\Re{(r)}>1$ or $\Re{(r)}<-1.$  This is not surprising given that $\text{arccot}(x) =\arctan(1/x)$ for $x>0.$  However, there is a $\pi$ to be added if $x<0.$ 
Given the symmetry within the integral, (1) is sufficient, so long as the user makes sure that the $r$ put in on the right-hand side has a real part $-1<\Re{(r)}<1$
I would like a proof (or if the formula exists, a reference) of (1), and with special attention paid to the complexity of the parameter $r.$ 
 [/INST] From the generating function of the Chebyshev polynomials of the second kind:
\begin{equation}
 \frac{1}{1-2xz+z^{2}}=\sum_{n=0}^{\infty}U_{n}\left(x\right)z^{n}
\end{equation} 
valid for $\left|z\right|<1$, we chose $z=-r, x=\cos\left( 2y \right)$ to express
\begin{equation}
 \frac{\sin(2  y)  } {r + 1/r + 2 \cos{(2  y)} } =\sum_{n=0}^{\infty}(-1)^n \sin\left( 2(n+1)y \right)r^{n+1}
\end{equation} 
as $U_n(\cos z)=\sin\left( (n+1)z \right)/\sin z$.
The Fourier series for $\ln\left( \sin(y/2) \right)$ reads
\begin{equation}
 \log\sin\frac{y}{2}=-\log 2-\sum_{p=1}^\infty\frac{1}{p}\cos(py)\qquad\forall y\in(0,2\pi)
\end{equation} 
and thus
\begin{align}
 I&=- \int_0^\pi \frac{\sin(2  y) \log(\sin (y/2)) } {r + 1/r + 2 \cos{(2  y)} } \,dy\\
 &=\int_0^\pi
 \left( \log 2+\sum_{p= 1}^\infty\frac{1}{p}\cos(py) \right)\left( \sum_{n=0}^{\infty}(-1)^n \sin\left( 2(n+1)y \right)r^{n+1} \right)\,dy
\end{align}
Using symmetry properties, the contributions of the $\log2$ term and of the terms with even values of $p$ vanish:
\begin{align}
 I&=\sum_{n=0}^\infty\sum_{s=0}^\infty\frac{(-1)^nr^{n+1}}{2s+1}\int_0^\pi\cos\left( (2s+1)y \right)\sin\left( 2(n+1)y \right)\,dy\\
 &=\sum_{n=0}^\infty\sum_{s=0}^\infty\frac{(-1)^nr^{n+1}}{2s+1}\left[\frac{1}{2n-2s+1}+\frac{1}{2n+2s+3}\right]
\end{align}
A decomposition of the double sum can be written as
\begin{align}
 I&=\sum_{n=0}^\infty\sum_{s=0}^n\frac{(-1)^nr^{n+1}}{2s+1}\frac{1}{2n-2s+1}+
 \sum_{n=0}^\infty\sum_{s=n+1}^\infty\frac{(-1)^nr^{n+1}}{2s+1}\frac{1}{2n-2s+1}+
 \sum_{n=0}^\infty\sum_{s=0}^\infty\frac{(-1)^nr^{n+1}}{2s+1}\frac{1}{2n+2s+3}
 \end{align}
 By changing $k=s+n+1$ in the last double sum, we obtain
 \begin{equation}
   \sum_{n=0}^\infty\sum_{s=0}^\infty\frac{(-1)^nr^{n+1}}{2s+1}\frac{1}{2n+2s+3}=-\sum_{n=0}^\infty\sum_{k=n+1}^\infty\frac{(-1)^nr^{n+1}}{2n-2k+1}\frac{1}{2k+1}
 \end{equation} 
 which is the opposite of the second double sum. Now, if $r^{1/2}$ is defined with its principal value, the integral can be expressed as
 \begin{align}
  I&=\sum_{n=0}^\infty\sum_{s=0}^n\frac{(-1)^nr^{n+1}}{2s+1}\frac{1}{2n-2s+1}\\
  &=\sum_{n=0}^\infty\sum_{s=0}^n
  \frac{(-1)^{s}r^{s+1/2}}{2s+1}
  \frac{(-1)^{n-s}r^{n-s+1/2}}{2(n-s)+1}\\
  &=\left( \sum_{t=0}^\infty
  \frac{(-1)^{t}r^{t+1/2}}{2t+1} \right)^2\\
  &=\left( \arctan\left(r^{1/2}\right) \right)^2
 \end{align}
as proposed.
</s>