$\newcommand{\+}{^{\daga}}
\newcommand{\ángulos}[1]{\left\langle\, nº 1 \,\right\rangle}
\newcommand{\llaves}[1]{\left\lbrace\, nº 1 \,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\, nº 1 \,\right\rbrack}
\newcommand{\ceil}[1]{\,\left\lceil\, nº 1 \,\right\rceil\,}
\newcommand{\dd}{{\rm d}}
\newcommand{\down}{\downarrow}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
\newcommand{\fermi}{\,{\rm f}}
\newcommand{\piso}[1]{\,\left\lfloor #1 \right\rfloor\,}
\newcommand{\mitad}{{1 \over 2}}
\newcommand{\ic}{{\rm i}}
\newcommand{\iff}{\Longleftrightarrow}
\newcommand{\imp}{\Longrightarrow}
\newcommand{\isdiv}{\,\left.\a la derecha\vert\,}
\newcommand{\cy}[1]{\left\vert #1\right\rangle}
\newcommand{\ol}[1]{\overline{#1}}
\newcommand{\pars}[1]{\left (\, nº 1 \,\right)}
\newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\parcial #3^{#1}}}
\newcommand{\pp}{{\cal P}}
\newcommand{\raíz}[2][]{\,\sqrt[#1]{\vphantom{\large Un}\,#2\,}\,}
\newcommand{\sech}{\,{\rm sech}}
\newcommand{\sgn}{\,{\rm sgn}}
\newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
\newcommand{\ul}[1]{\underline{#1}}
\newcommand{\verts}[1]{\left\vert\, nº 1 \,\right\vert}
\newcommand{\wt}[1]{\widetilde{#1}}$
\begin{align}&\color{#c00000}{\int_{0}^{\pi/2}\arctan\pars{a\sin\pars{x}}\,\dd x}
={\pi \over 2}\,\arctan\pars{a}
-\int_{0}^{\pi/2}x\,{a\cos\pars{x} \over a^{2}\sin^{2}\pars{x} + 1}\,\dd x
\\[3mm]&={\pi \over 2}\,\arctan\pars{a}
-a\,\Re\color{#00f}{\int_{0}^{\pi/2}{x\cos\pars{x} \over 1 + \verts{a}\sin\pars{x}\ic}\,\dd x}
\end{align}
\begin{align}&\color{#00f}{\int_{0}^{\pi/2}{x\cos\pars{x}\over
1 + \verts{a}\sin\pars{x}\ic}\,\dd x}
=
\oint_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}}
{-\ic\ln\pars{z}\pars{z^{2} + 1}/\pars{2z}\over
1 + \verts{a}\pars{z^{2} - 1}/\pars{2\ic z}}\,{\dd z \over \ic z}
\\[3mm]&=\ic
\oint_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}}
{\ln\pars{z}\pars{z^{2} + 1} \over \verts{a}z^{2} + 2\ic z - \verts{a}}
\,{\dd z \over z}
\\[3mm]&={\ic \over \verts{a}}
\oint_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}}
{\ln\pars{z}\pars{z^{2} + 1} \over \pars{z - z_{-}}\pars{z - z_{+}}}
\,{\dd z \over z}\,,\qquad z_{\pm}
\equiv {-\ic \pm \root{a^{2} - 1} \over \verts{a}}
\end{align}
Tenga en cuenta que $\ds{z_{-}\,z_{+} = -1}$.
También,
\begin{align}&{z^{2} + 1 \over \pars{z - z_{-}}\pars{z - z_{+}}}
=\pars{{z^{2} + 1 \over z - z_{+}} - {z^{2} + 1 \over z - z_{-}}}
\,{1 \over z_{+} - z_{-}}
\\[3mm]&={1 \over z_{+} - z_{-}}\,\pars{z + z_{+} + {z_{+}^{2} + 1 \over z - z_{+}}
-z - z_{-} - {z_{-}^{2} + 1 \over z - z_{-}}}
=1 + {1 \over z_{+} - z_{-}}
\sum_{\sigma = \pm}\sigma\,{z_{\sigma}^{2} + 1 \over z - z_{\sigma}}
\end{align}
y
\begin{align}&{z^{2} + 1 \over \pars{z - z_{-}}\pars{z - z_{+}}z}
={1 \over z} + {1 \over z_{+} - z_{-}}
\sum_{\sigma = \pm}\sigma\,{z_{\sigma}^{2} + 1 \over \pars{z - z_{\sigma}}z}
\\[3mm]&={1 \over z} + {1 \over z_{+} - z_{-}}
\sum_{\sigma = \pm}\sigma\,\pars{z_{\sigma}^{2} + 1}
\pars{{1 \over z - z_{\sigma}} - {1 \over z}}\,{1 \over z_{\sigma}}
\\[3mm]&=\pars{1 - {1 \over z_{+} - z_{-}}%
\sum_{\sigma = \pm}\sigma\,\pars{z_{\sigma} - z_{-\sigma}}}\,{1 \over z}
+{1 \over z_{+} - z_{-}}\sum_{\sigma = \pm}
{\sigma\pars{z_{\sigma} - z_{-\sigma}} \over z - z_{\sigma}}
\\[3mm]&=-\,{1 \over z}
+\sum_{\sigma = \pm}{1 \over z - z_{\sigma}}
\end{align}
\begin{align}&\color{#00f}{\int_{0}^{\pi/2}{x\cos\pars{x}\over
1 + \verts{a}\sin\pars{x}\ic}\,\dd x}
\\[3mm]&=-\,{\ic \over \verts{a}}\ \underbrace{%
\oint_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}}
{\ln\pars{z} \over z}\,\dd z}_{\ds{=\ -\,{\pi^{2} \over 8}}}\
+\
{\ic \over \verts{a}}\sum_{\sigma=\pm}
\oint_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}}
{\ln\pars{z} \over z - z_{\sigma}}\,\dd z
\end{align}
\begin{align}&\color{#c00000}{\int_{0}^{\pi/2}\arctan\pars{a\sin\pars{x}}\,\dd x}
={\pi \over 2}\,\arctan\pars{a}
+\sgn\pars{a}\,\Im\sum_{\sigma=\pm}
\oint_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}}
{\ln\pars{z} \over z - z_{\sigma}}\,\dd z
\end{align}
Con
\begin{align}&
\oint_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}}
{\ln\pars{z} \over z - z_{\sigma}}\,\dd z
=-\int_{1}^{0}{\ln\pars{y} + \ic\pi/2 \over \ic y - z_{\sigma}}\,\ic\dd y
-\int_{0}^{1}{\ln\pars{x} \over x - z_{\sigma}}\,\dd x
\\[3mm]&=\ic\,{\pi \over 2}\int_{0}^{1}{\dd y \over y + z_{\sigma}\,\ic}
+\int_{0}^{1}{\ln\pars{y} \over z_{\sigma}\ic + y}\,\dd y
-\int_{0}^{1}{\ln\pars{x} \over -z_{\sigma} + x}\,\dd x
\\[3mm]&=\ic\,{\pi \over 2}\,\ln\pars{1 + z_{\sigma}\ic \over z_{\sigma}\ic}
+{\rm Li}_{2}\pars{-\,{1 \over z_{\sigma}\ic}}
-{\rm Li}_{2}\pars{-\,{1 \over z_{\sigma}}}
\\[3mm]&=\ic\,{\pi \over 2}\,\ln\pars{1 + z_{-\sigma}\ic}
+ {\rm Li}_{2}\pars{-z_{-\sigma}\ic} - {\rm Li}_{2}\pars{z_{-\sigma}}
\end{align}
desde
\begin{align}
&\int_{0}^{1}{\ln\pars{\xi}\,\dd\xi \over b + \xi}
=-\int_{0}^{-1/b}{\ln\pars{-b\xi}\,\dd\xi \over 1 - \xi}
=-\int_{0}^{-1/b}{\ln\pars{1 - \xi} \over \xi}\,\dd\xi
\\[3mm]&=
\int_{0}^{-1/b}{\rm Li}_{2}'\pars{\xi}\,\dd xi={\rm Li}_{2}\pars{-\,{1 \over b}}
\end{align}
El resultado final se convierte en
\begin{align}
&\color{#c00000}{\int_{0}^{\pi/2}\arctan\pars{a\sin\pars{x}}\,\dd x}
\\[3mm]&={\pi \over 2}\,\arctan\pars{a}
+
{\pi\sgn\pars{a} \over 2}\,\ln\pars{2\,{\verts{a} + 1 \over \verts{a}}}
\\[3mm]&+\sgn\pars{a}\Im\left\lbrack%
{\rm Li}_{2}\pars{-1 - \ic\root{a^{2} - 1} \over \verts{a}}
-{\rm Li}_{2}\pars{-\ic + \root{a^{2} - 1} \over \verts{a}}\right.
\\[3mm]&\phantom{\sgn\pars{a}\Im\bracks{}}\left.+{\rm Li}_{2}\pars{-1 + \ic\root{a^{2} - 1} \over \verts{a}}
-{\rm Li}_{2}\pars{-\ic - \root{a^{2} - 1} \over \verts{a}}\right\rbrack
\end{align}