Let us compute
$$I(A)=\int_{0}^{\pi/2}\frac{dt}{1+A\cos t}$$
for $A\in(-1,1)$. By using the Weierstrass substitution as suggested by Venus, we have:
$$I(A) = 2\int_{0}^{1}\frac{du}{(1+A)+(1-A)u^2} = \frac{2}{1+A}\int_{0}^{1}\frac{du}{1+\frac{1-A}{1+A}\,u^2}\tag{1}$$
and by setting $u=\sqrt{\frac{1+A}{1-A}}v\ $ we get:
$$I(A) = \frac{2}{\sqrt{1-A^2}}\int_{0}^{\sqrt{\frac{1-A}{1+A}}}\frac{dv}{1+v^2}=\frac{2}{\sqrt{1-A^2}}\,\arctan\sqrt{\frac{1-A}{1+A}}\tag{2}$$
so:
$$ I(\cos\theta) = \frac{2}{|\sin\theta\,|}\arctan\left|\tan\frac{\theta}{2}\right|=\color{red}{\frac{\theta}{\sin\theta}}\tag{3}$$
for any $\theta\in(-\pi,\pi).$