<s>[INST] Integrate $I(a) = \int_0^{\pi/2} \frac{dx}{1-a\sin x}$ I have a problem with this integral. It seems that solution has to be simple, but I couldn't find out.
$$I(a) = \int_0^{\pi/2} \frac{dx}{1-a\sin x}$$
I tried using integration by parts and differentiating with regard to a, but neither helped.
 [/INST] Observe that your integral is convergent in the usual sense for $|a|<1$. You may then write $t=\tan \dfrac{x}{2}$,  giving $ \sin x=\dfrac{2t}{1+t^2}$.
Hence
$$
\begin{align}
I(a) &= \int_0^{\pi/2} \frac{dx}{1-a\sin x}\\\\
&= 2\int_0^{1} \frac{1}{1-a\dfrac{2t}{1+t^2}}\frac{dt}{1+t^2}\\\\
&= 2\int_0^{1} \frac{1}{(t-a)^2+(1-a^2)}dt\quad \left(t-a=\sqrt{1-a^2}\:u,\,dt=\sqrt{1-a^2}\:du\right)\\\\
&= \frac{2}{\sqrt{1-a^2}}\int_{-a/\sqrt{1-a^2}}^{(1-a)/\sqrt{1-a^2}} \frac{1}{u^2+1}du\quad \\\\
&= \frac{2}{\sqrt{1-a^2}}\arctan \left(\sqrt{\frac{1+a}{1-a}}\right)
\end{align}
$$
</s>