Two related integral formulas are $$I(m,r) = \int_{0}^{\pi/2} \sin \left((2m+1)x \right) \arctan \left(\frac{2r \sin x}{1-r^{2}} \right) \, \mathrm dx = \frac{\pi}{2} \frac{r^{2m+1}}{2m+1} , \quad \mathrm |r| <1,$$ and $$J(m,r) = \int_{0}^{\pi/2} \cos\left((2m+1)x \right) \ln \left(\frac{1+2r \cos(x)+r^{2}}{1-2r \cos(x)+r^{2}} \right) \, \mathrm dx = \pi \, \frac{r^{2m+1}}{2m+1}, \quad |r| <1. $$
I'll prove the second formula.
The first formula can be derived in the same manner using the Fourier series for $\arctan \left(\frac{2r \sin x}{1-r^{2}} \right)$ obtained in Sangchul Lee's answer here.
For $|z| < 1$, $\ln(1-z)$ has the Taylor series $$\ln(1-z) = -\sum_{n=1}^{\infty} \frac{z^{n}}{n}. $$
Replacing $z$ with $re^{i x}$, where $|r|< 1$ and $x \in \mathbb{R}$, and then equating the real parts on both sides of the equation, we get $$\sum_{n=1}^{\infty} \frac{r^{n} \cos(nx)}{n} = -\frac{1}{2} \, \ln \left(1-2r \cos(x)+r^{2} \right). $$
Therefore, $$ \begin{align} \sum_{n=0}^{\infty} \frac{r^{2n+1} \cos\left((2n+1)x \right)}{2n+1} &= \frac{1}{2} \left( \sum_{n=1}^{\infty} \frac{r^{n} \cos(nx)}{n} - \sum_{n=1}^{\infty} \frac{(-1)^{n}r^{n} \cos(nx)}{n} \right) \\ &= \frac{1}{4} \, \ln \left(\frac{1+2r \cos(x)+r^{2}}{1-2r \cos(x)+r^{2}} \right), \end{align}$$
and $$ \begin{align} J(m,r) &= \int_{0}^{\pi/2} \cos\left((2m+1)x \right) \ln \left(\frac{1+2r \cos(x)+r^{2}}{1-2r \cos(x)+r^{2}} \right) \, \mathrm dx \\ &= 4 \int_{0}^{\pi/2} \cos \left((2m+1)x \right) \sum_{n=0}^{\infty} \frac{r^{2n+1} \cos\left((2n+1)x \right)}{2n+1} \, \mathrm dx\\ &= 4 \sum_{n=0}^{\infty} \frac{r^{2n+1}}{2n+1} \int_{0}^{\pi/2} \cos \left((2m+1)x \right) \cos \left((2n+1)x \right) \, \mathrm dx. \end{align}$$
If $n \ne m$, the value of the integral is zero. If $n=m$, the value of the integral is $\frac{\pi}{4}$.
This leads to the result.