Closed form evaluation of a trigonometric integral in terms of polylogarithms 
Define the function $\mathcal{K}:\mathbb{R}\times\mathbb{R}\times\left(-\frac{\pi}{2},\frac{\pi}{2}\right)\times\left(-\frac{\pi}{2},\frac{\pi}{2}\right)\rightarrow\mathbb{R}$ via the definite integral
$$\mathcal{K}{\left(a,b,\psi,\omega\right)}:=\int_{\psi}^{\omega}\mathrm{d}\varphi\,\arctan{\left(a+b\tan{\left(\varphi\right)}\right)}.\tag{1}$$
It's not too difficult to find a closed-form expression for the integral in the following special case: for all $b\in\mathbb{R}_{>0}\land\omega\in\left(-\frac{\pi}{2},\frac{\pi}{2}\right)$,
$$\begin{align}
\mathcal{K}{\left(0,b,0,\omega\right)}
&=\int_{0}^{\omega}\mathrm{d}\varphi\,\arctan{\left(b\tan{\left(\varphi\right)}\right)}\\
&=\frac12\omega^{2}+\frac12\operatorname{Li}_{2}{\left(-\frac{1-b}{1+b}\right)}-\frac12\operatorname{Li}_{2}{\left(\frac{1-b}{1+b},\pi-2\omega\right)},\tag{2}\\
\end{align}$$
where
$$\operatorname{Li}_{2}{\left(r,\theta\right)}:=-\frac12\int_{0}^{r}\mathrm{d}x\,\frac{\ln{\left(1-2x\cos{\left(\theta\right)}+x^{2}\right)}}{x};~~~\small{\left(r,\theta\right)\in\mathbb{R}^{2}}.\tag{3}$$
I would like to consider, however, the general evaluation of $\mathcal{K}{\left(a,b,\psi,\omega\right)}$ under the conditions
$$0<a\land\sqrt{1+a^{2}}<b\land-\frac{\pi}{4}\le\psi<\omega\le\frac{\pi}{4}.\tag{4}$$
It is in fact possible to obtain a closed-form for $\mathcal{K}$ in terms of the two-variable dilogarithm in this case as well. But how best to obtain/verify such an expression?

 A: 
The following approach is modeled after Lewin's Polylogarithms and Associated Functions. It's a little cumbersome though, and it seems to break down unless the conditions specified in $(4)$ are met. A more general method would be welcomed.

Suppose $A\in\mathbb{R}\land B\in\mathbb{R}_{\neq0}\land\phi\in\left(-\frac{\pi}{4},\frac{\pi}{4}\right)\land\varphi\in\left[-\frac{\pi}{4},\frac{\pi}{4}\right]$. Then, $-\frac{\pi}{2}<\phi+\varphi<\frac{\pi}{2}\land-1<\tan{\left(\phi\right)}\tan{\left(\varphi\right)}<1$, and by the tangent angle addition formula we have
$$\tan{\left(\phi+\varphi\right)}=\frac{\tan{\left(\phi\right)}+\tan{\left(\varphi\right)}}{1-\tan{\left(\phi\right)}\tan{\left(\varphi\right)}}.$$
Recall the arctangent addition formula:
$$\arctan{\left(z\right)}+\arctan{\left(w\right)}=\arctan{\left(\frac{z+w}{1-zw}\right)};~~~\small{\left(z,w\right)\in\mathbb{R}^{2}\land zw<1}.$$
Taking $z=A\land w=B\tan{\left(\phi+\varphi\right)}$, we then have
$$\arctan{\left(A\right)}+\arctan{\left(B\tan{\left(\phi+\varphi\right)}\right)}=\arctan{\left(\frac{A+B\tan{\left(\phi+\varphi\right)}}{1-AB\tan{\left(\phi+\varphi\right)}}\right)},$$
provided that $AB\tan{\left(\phi+\varphi\right)}<1$.
Adding the constraint $AB=-\tan{\left(\phi\right)}$, we find that
$$\begin{align}
1-AB\tan{\left(\phi+\varphi\right)}
&=1+\tan{\left(\phi\right)}\tan{\left(\phi+\varphi\right)}\\
&=1+\tan{\left(\phi\right)}\frac{\tan{\left(\phi\right)}+\tan{\left(\varphi\right)}}{1-\tan{\left(\phi\right)}\tan{\left(\varphi\right)}}\\
&=\frac{1+\tan^{2}{\left(\phi\right)}}{1-\tan{\left(\phi\right)}\tan{\left(\varphi\right)}}\\
&=\frac{\sec^{2}{\left(\phi\right)}}{1-\tan{\left(\phi\right)}\tan{\left(\varphi\right)}}>0,\\
\end{align}$$
and so
$$-\arctan{\left(\frac{\tan{\left(\phi\right)}}{B}\right)}+\arctan{\left(B\tan{\left(\phi+\varphi\right)}\right)}=\arctan{\left(\frac{A+B\tan{\left(\phi+\varphi\right)}}{1-AB\tan{\left(\phi+\varphi\right)}}\right)},$$
where
$$\begin{align}
\frac{A+B\tan{\left(\phi+\varphi\right)}}{1-AB\tan{\left(\phi+\varphi\right)}}
&=\frac{-B^{-1}\tan{\left(\phi\right)}+B\tan{\left(\varphi+\phi\right)}}{1+\tan{\left(\phi\right)}\tan{\left(\varphi+\phi\right)}}\\
&=\frac{-B^{-1}\tan{\left(\phi\right)}+B\left[\frac{\tan{\left(\varphi\right)}+\tan{\left(\phi\right)}}{1-\tan{\left(\varphi\right)}\tan{\left(\phi\right)}}\right]}{1+\tan{\left(\phi\right)}\left[\frac{\tan{\left(\varphi\right)}+\tan{\left(\phi\right)}}{1-\tan{\left(\varphi\right)}\tan{\left(\phi\right)}}\right]}\\
&=\frac{-B^{-1}\tan{\left(\phi\right)}\left[1-\tan{\left(\varphi\right)}\tan{\left(\phi\right)}\right]+B\left[\tan{\left(\varphi\right)}+\tan{\left(\phi\right)}\right]}{\left[1-\tan{\left(\varphi\right)}\tan{\left(\phi\right)}\right]+\tan{\left(\phi\right)}\left[\tan{\left(\varphi\right)}+\tan{\left(\phi\right)}\right]}\\
&=\frac{-\tan{\left(\phi\right)}+\tan^{2}{\left(\phi\right)}\tan{\left(\varphi\right)}+B^{2}\tan{\left(\phi\right)}+B^{2}\tan{\left(\varphi\right)}}{B\sec^{2}{\left(\phi\right)}}\\
&=\frac{\left(B^{2}-1\right)\tan{\left(\phi\right)}+\left[\tan^{2}{\left(\phi\right)}+B^{2}\right]\tan{\left(\varphi\right)}}{B\sec^{2}{\left(\phi\right)}}\\
&=\frac{B^{2}-1}{2B}\sin{\left(2\phi\right)}+\frac{B^{2}\cos^{2}{\left(\phi\right)}+\sin^{2}{\left(\phi\right)}}{B}\tan{\left(\varphi\right)}.\\
\end{align}$$

Given fixed but arbitrary $\left(a,b\right)\in\mathbb{R}^{2}$ such that $0<a\land\sqrt{1+a^{2}}<b$, consider the problem of finding all $\left(B,\phi\right)\in\mathbb{R}_{\neq0}\times\left(-\frac{\pi}{4},\frac{\pi}{4}\right)$ satisfying the system of equations
$$\frac{B^{2}-1}{2B}\sin{\left(2\phi\right)}=a,$$
$$\frac{B^{2}\cos^{2}{\left(\phi\right)}+\sin^{2}{\left(\phi\right)}}{B}=b.$$
From the second equation, $0<b\land0<B$. Setting $\beta:=2\arctan{\left(B\right)}$, we have $0<\beta<\pi\land B=\tan{\left(\frac{\beta}{2}\right)}$, and the system of equations can be rewritten as
$$\cos{\left(\beta\right)}\sin{\left(2\phi\right)}=-a\sin{\left(\beta\right)},$$
$$\cos{\left(\beta\right)}\cos{\left(2\phi\right)}=1-b\sin{\left(\beta\right)}.$$
Squaring both equations and adding them together,
$$\cos^{2}{\left(\beta\right)}=\left[-a\sin{\left(\beta\right)}\right]^{2}+\left[1-b\sin{\left(\beta\right)}\right]^{2},$$
$$\implies1-\sin^{2}{\left(\beta\right)}=a^{2}\sin^{2}{\left(\beta\right)}+\left[1-2b\sin{\left(\beta\right)}+b^{2}\sin^{2}{\left(\beta\right)}\right],$$
$$\implies2b\sin{\left(\beta\right)}=\left(1+a^{2}+b^{2}\right)\sin^{2}{\left(\beta\right)},$$
$$\implies\sin{\left(\beta\right)}=\frac{2b}{1+a^{2}+b^{2}}.$$
Then, dividing the first equation by the second we have
$$\tan{\left(2\phi\right)}=\frac{a\sin{\left(\beta\right)}}{b\sin{\left(\beta\right)}-1}=\frac{2ab}{b^{2}-a^{2}-1},$$
$$\implies0<\phi<\frac{\pi}{4}\land1<B\land\frac{\pi}{2}<\beta<\pi.$$
The unique solution to our system of equations is found to be
$$B=\frac{\left[\sqrt{a^{2}+\left(b+1\right)^{2}}+\sqrt{a^{2}+\left(b-1\right)^{2}}\right]^{2}}{4b}\land\phi=\frac12\arctan{\left(\frac{2ab}{b^{2}-a^{2}-1}\right)}.$$

Suppose $\left(a,b,\psi,\omega\right)\in\mathbb{R}\times\mathbb{R}\times\left(-\frac{\pi}{2},\frac{\pi}{2}\right)\times\left(-\frac{\pi}{2},\frac{\pi}{2}\right)$, and assume $0<a\land\sqrt{1+a^{2}}<b\land-\frac{\pi}{4}\le\psi<\omega\le\frac{\pi}{4}$. Set
$$B:=\frac{\left[\sqrt{a^{2}+\left(b+1\right)^{2}}+\sqrt{a^{2}+\left(b-1\right)^{2}}\right]^{2}}{4b}\land\phi:=\frac12\arctan{\left(\frac{2ab}{b^{2}-a^{2}-1}\right)},$$
and note that $1<B\land0<\phi<\frac{\pi}{4}$. We then have
$$\forall\varphi\in\left[-\frac{\pi}{4},\frac{\pi}{4}\right]:\arctan{\left(a+b\tan{\left(\varphi\right)}\right)}=-\arctan{\left(\frac{\tan{\left(\phi\right)}}{B}\right)}+\arctan{\left(B\tan{\left(\phi+\varphi\right)}\right)}.$$
Finally,
$$\begin{align}
\mathcal{K}{\left(a,b,\psi,\omega\right)}
&=\int_{\psi}^{\omega}\mathrm{d}\varphi\,\arctan{\left(a+b\tan{\left(\varphi\right)}\right)}\\
&=-\int_{\psi}^{\omega}\mathrm{d}\varphi\,\arctan{\left(\frac{\tan{\left(\phi\right)}}{B}\right)}+\int_{\psi}^{\omega}\mathrm{d}\varphi\,\arctan{\left(B\tan{\left(\phi+\varphi\right)}\right)}\\
&=-\left(\omega-\psi\right)\arctan{\left(\frac{\tan{\left(\phi\right)}}{B}\right)}+\int_{\psi}^{\omega}\mathrm{d}\varphi\,\arctan{\left(B\tan{\left(\phi+\varphi\right)}\right)}\\
&=-\left(\omega-\psi\right)\arctan{\left(\frac{\tan{\left(\phi\right)}}{B}\right)}+\int_{\phi+\psi}^{\phi+\omega}\mathrm{d}\varphi\,\arctan{\left(B\tan{\left(\varphi\right)}\right)};~~~\small{\left[\varphi\mapsto\varphi-\phi\right]}\\
&=-\left(\omega-\psi\right)\arctan{\left(\frac{\tan{\left(\phi\right)}}{B}\right)}+\int_{0}^{\phi+\omega}\mathrm{d}\varphi\,\arctan{\left(B\tan{\left(\varphi\right)}\right)}\\
&~~~~~-\int_{0}^{\phi+\psi}\mathrm{d}\varphi\,\arctan{\left(B\tan{\left(\varphi\right)}\right)}\\
&=-\left(\omega-\psi\right)\arctan{\left(\frac{\tan{\left(\phi\right)}}{B}\right)}\\
&~~~~~+\frac12\left(\phi+\omega\right)^{2}+\frac12\operatorname{Li}_{2}{\left(-\frac{1-B}{1+B}\right)}-\frac12\operatorname{Li}_{2}{\left(\frac{1-B}{1+B},\pi-2\phi-2\omega\right)}\\
&~~~~~-\frac12\left(\phi+\psi\right)^{2}-\frac12\operatorname{Li}_{2}{\left(-\frac{1-B}{1+B}\right)}+\frac12\operatorname{Li}_{2}{\left(\frac{1-B}{1+B},\pi-2\phi-2\psi\right)}\\
&=\frac12\left(\phi+\omega\right)^{2}-\frac12\left(\phi+\psi\right)^{2}-\left(\omega-\psi\right)\arctan{\left(\frac{\tan{\left(\phi\right)}}{B}\right)}\\
&~~~~~-\frac12\operatorname{Li}_{2}{\left(\frac{1-B}{1+B},\pi-2\phi-2\omega\right)}+\frac12\operatorname{Li}_{2}{\left(\frac{1-B}{1+B},\pi-2\phi-2\psi\right)}.\blacksquare\\
\end{align}$$

