TITLE: A combination integral and series resulting the inverse tangent integral
QUESTION [20 upvotes]: $\def\Ti{{\rm{Ti}}_2}$I have been able to solve an integral problem, now I tried to use the other method to crack the integral and I have to prove the following expression

\begin{equation}
I=\sum_{n=1}^\infty \frac{z^{2n-1}}{2n-1}\int_0^{\Large\frac{\pi}{2}}\sin(2n-1)x\cot x\,dx=-\frac{1}{2}\Ti\left(\frac{1-z^2}{2z}\right)\qquad\quad\quad(\star)
\end{equation}

where $\Ti(\cdot)$ is the inverse tangent integral.
I managed to evaluate the integral and I obtained (if I am not mistaken)
\begin{equation}
\int_0^{\Large\frac{\pi}{2}}\sin(2n-1)x\cot x\,dx=\frac{(-1)^{n-1}}{2n-1}+2\sum_{k=1}^{n-1}\frac{(-1)^{k-1}}{2k-1}
\end{equation}
then
\begin{equation}
I=\sum_{n=1}^\infty \frac{z^{2n-1}}{2n-1}\left[\frac{(-1)^{n-1}}{2n-1}+2\sum_{k=1}^{n-1}\frac{(-1)^{k-1}}{2k-1}\right]=\Ti\left(z\right)+2\sum_{n=1}^\infty \frac{z^{2n-1}}{2n-1}\sum_{k=1}^{n-1}\frac{(-1)^{k-1}}{2k-1}
\end{equation}
I am stuck in the last expression. Could anyone here please help me to prove the expression $(\star)$? Any help would be greatly appreciated. Thank you.

REPLY [4 votes]: I stress that this is not a solution, but such a comment was too long to fit above.
I got a different formula for
\begin{equation}
\int_0^{\Large\frac{\pi}{2}}\sin(2n-1)x\cot x\,dx=\frac{(-1)^{n-1}}{2n-1}+2\sum_{k=1}^{n-1}\frac{(-1)^{k-1}}{2k-1}
\end{equation}
than what you posted. But after close inspection, they can be shown to be equivalent by induction. Anyway, I put my work here for clarity in case others are curious.
I'd also like to point out the identity
\begin{equation*}
2\tan^{-1}(z) = \tan^{-1}\left(\frac{2z}{1-z^{2}}\right)
\end{equation*}
which may help in putting the right hand side in the correct form.
Let $w = e^{ikx}$ and note that
\begin{align*}
\sum_{k=1}^{n-1}w^{2k} & =  \frac{w^{2n} - w^{2}}{w^{2} - 1}\\
& = \frac{w^{2n-1} - w}{w - w^{-1}}\\
& = \frac{\cos((2n-1)x) + i \sin((2n-1)x) - \cos{x} - i\sin{x}}{2i\sin{x}}.
\end{align*}
Taking the real parts, we have
\begin{equation*}
\sum_{k=1}^{n-1}\cos(2kx) = \frac{\sin((2n-1)x)}{2\sin{x}} - \frac{1}{2}.
\end{equation*}
Multiplying both sides by $\cos{x}$ and rearranging yields
\begin{equation*}
\sin((2n-1)x)\cot(x) = \cos{x} + 2\sum_{k=1}^{n-1}\cos(2kx)\cos{x} 
\end{equation*}
Now we use the fact that
\begin{equation*}
2\cos(2kx)\cos{x} = \cos((2k+1)x) + \cos((2k-1)x)
\end{equation*}
to get
\begin{align*}
\int_{0}^{\pi/2} \sin((2n-1)x)\cot{x}\,dx & = \int_{0}^{\pi/2}\cos{x}\,dx + \sum_{k=1}^{n-1}\int_{0}^{\pi/2}\left[\cos((2k+1)x) + \cos((2k-1)x)\right]\,dx\\
& = 1 + \sum_{k=1}^{n-1}\left[ \frac{\sin((2k+1)x)}{2k+1} + \frac{\sin((2k-1)x)}{2k-1} \right]_{x=0}^{\pi/2}\\
& = 1 + \sum_{k=1}^{n-1}\frac{(-1)^{k}}{2k+1} + \frac{(-1)^{k-1}}{2k-1}\\
& = 1 + \sum_{k=1}^{n-1}(-1)^{k}\frac{-2}{(2k+1)(2k-1)}\\
& = 1 + 2\sum_{k=1}^{n-1}\frac{(-1)^{k-1}}{(2k+1)(2k-1)}
\end{align*}