The value of $\int^{\pi/2}_0 \frac{\log(1+x\sin^2\theta)}{\sin^2\theta}d\theta$ Problem : 
Find the value of $\int^{\pi/2}_0 \frac{\log(1+x\sin^2\theta)}{\sin^2\theta}d\theta$ 
Now how to use Leibnitz's rule : $\frac{d}{dx}(\int^{\psi(x)}_{\phi(x)} f(t)dt) = \frac{d}{dx}\{\psi(x)\} f(\psi(x)) -\frac{d}{dx}\{\phi(x)\} f(\phi (x)\}$ here 
please guide will be of great help thanks as  there is  $x$ and $\theta$ both 
 A: Let:
$$ f(x) = \int_{0}^{\pi/2}\frac{\log(1+x\sin^2\theta)}{\sin^2\theta}\,d\theta.\tag{1}$$
We have $f(0)=0$ and for every $x\geq 0$:
$$ f'(x) = \int_{0}^{\pi/2}\frac{d\theta}{1+x\sin^2\theta}=\frac{\pi}{2\sqrt{1+x}}\tag{2}$$
through Weierstrass substitution. Integrating back,
$$ f(x) = \pi\left(\sqrt{1+x}-1\right).\tag{3}$$
A: In the interests of alternative methods: $$\int_0^{\pi/2}\frac{\log(1+x\sin^2\theta)}{\sin^2\theta}d\theta =-\sum_{k=1}^\infty\frac{(-1)^kx^k}{k}\int_0^{\pi/2}\sin^{2k-2}\theta d\theta.$$ Now let $u=\sin\theta$, then $\frac{du}{\sqrt{1-u^2}}=d\theta$ and we have
$$-\sum_{k=1}^\infty\frac{(-1)^kx^k}{k}\int_0^1\frac{u^{2k-2}}{\sqrt{1-u^2}}du = -\frac{\sqrt{\pi}}{2}\sum_{k=1}^\infty\frac{(-1)^kx^k}{k}\frac{\Gamma\left(k-\frac{1}{2}\right)}{\Gamma(k)}.$$ Mathematica quickly evaluates this to have closed form
$$\pi\left(\sqrt{x+1}-1\right),$$
hence we have
$$\int_0^{\pi/2}\frac{\log(1+x\sin^2\theta)}{\sin^2\theta}d\theta=\pi\left(\sqrt{x+1}-1\right).$$
There may be conditions on $x$ and the exchange of integral and summation would need to be justified. Proof of the summation would also be required of course.
A: Let $I(x)$ be the integral
$$I(x)=\int_0^{\pi/2}\frac{\log(1+x\sin^2 \theta)}{\sin^2\theta}d\theta$$
and assume that $x>0$ is real-valued.
Now, taking a derivative with respect to $x$ gives
$$I'(x)=\int_0^{\pi/2}\frac{1}{1+x\sin^2\theta}d\theta=\frac{\pi}{2\sqrt{1+x}}$$
where this latter integral was evaluated using contour integration.  
Next, integration of $I'(x)$ gives 
$$I(x)=\pi\sqrt{1+x}+C$$
where $C$ is found by noting $I(0)=0$.  Thus, $C=-\pi$.  
Finally, we have
$$I(x)=\pi(\sqrt{1+x}-1)$$

NOTE: 
Here, we will evaluate $\int_0^{\pi/2}\frac{1}{1+x\sin^2\theta}d\theta$ for $x<0$ using contour integration.  Note that in general, we have
$$\begin{align}
\int_0^{\pi/2}\frac{1}{1+x\sin^2\theta}d\theta & = \int_0^{\pi/2}\frac{1}{1+x\left(\frac{1-\cos 2\theta}{2}\right)}d\theta \tag 1 \\\\
&=-\frac{1}{2x}\int_0^{2\pi}\frac{1}{\cos \theta-a}d\theta \tag 2
\end{align}$$
where $a=\frac{2+x}{x}=1+\frac2x$.  In going from $(2)$ to $(3)$ we exploited the periodicity of the cosine function and effected the substitution $2x \to x$.  
Next, we move to the complex plane by letting $z=e^{i\theta}$ so that $dz=ie^{i\theta}dz$ and the integration is over the closed-contour unit circle$C$, for which $|z|=1$.  Then, we have
$$\begin{align}
-\frac{1}{2x}\int_0^{2\pi}\frac{1}{\cos \theta-a}d\theta &=-\frac{1}{ix}\oint_C \frac{dz}{z^2-2az+1}\\\\
&=-\frac{2\pi}{x}\text{Res}\left(\frac{1}{(z-a+\sqrt{a^2-1})(z-a-\sqrt{a^2-1})}\right)\\\\
&=-\frac{2\pi}{x}\text{Res}\left(\frac{1}{(z-\frac{x+2}{x}-\frac{2\sqrt{x+1}}{|x|})(z-\frac{x+2}{x}+\frac{2\sqrt{x+1}}{|x|})}\right)
\end{align}$$
There are three cases we need to examine.  

Case 1: $x>0$ 
For $x>0$, the only pole is at $z=\frac{x+2-2\sqrt{x+1}}{x}$.  The residue is thus $-\frac{x}{4\sqrt{x+1}}$ and we have
$$I'(x)=\frac{\pi}{2\sqrt{x+1}}$$

Case 2: 
For $<-1x<0$, the only pole is at $z=\frac{x+2}{x}+2\frac{\sqrt{x+1}}{|x|}=\frac{x+2-2\sqrt{x+1}}{x}$.  The residue is $-frac{x}{4\sqrt{x+1}} and we have
$$I'(x)=\frac{\pi}{2\sqrt{x+1}}$$

Case 3: 
For $x<-1$, we note that $|\frac{x+2}{x}+2\frac{\sqrt{x+1}}{|x|}|=1$ and the poles are complex conjugates residing on the unit circle.  Thus, the integral diverges.  
We can intepret, however, a Cauchy Principal value of the integral.  Here, we exclude the poles by modifying the contour $C$ with a semi-circle deformation around each pole.  The two contributions from integration around the deformations are equal in magnitude and of opposite sign.  Thus, we have
$$I'(x)=0$$
