You can employ the substitution $y=1- k^2 \sin^2x$ such that the integral can be written as
$$ K(k) = \int_{1-k^2}^1\!dy\,\frac{1}{2 \sqrt{y(1-y)(y-1 +k^2)}}.$$
Now, we can expand the integrand in $\epsilon = 1-k$ and obtain
$$ K(k) = \int_{1-k^2}^1\!dy\frac{1}{2 y \sqrt{1-y}} + O(1). \tag{1}$$
The estimate of the error term follows from the fact that expanding in $\eta =1-k^2$, we have
$$K(k) = \sum_{n=0}^\infty c_n \eta^n \int_{\eta}^1\!dy\, y^{-1-n} (1-y)^{-1/2}$$
with $c_n$ some constants. Now, we have for $n>0$ that
$$ \int_{\eta}^1\!dy\, y^{-1-n} (1-y)^{-1/2} = O(\eta^{-n})$$
such that only the $n=0$ term diverges for $\eta \to 0$ (which corresponds to $\epsilon \to 0$).
It thus remains to estimate the first term in (1) for $k \to 1$ which is not that difficult:
In fact due to the $1/y$ behavior close to $y=0$, the integral is logarithmically divergent and we have that
$$K(k) = \frac12 \left|\log (1-k^2)\right| + O(1) = \frac12 \left|\log \epsilon\right| + O(1).$$
I prefer to have the singular behaviour near $0$ rather than at $\frac{\pi}{2}$, so let's make the substitution $\varphi = \frac{\pi}{2} - \theta$. We obtain
$$K(k) = \int_0^{\frac{\pi}{2}} \frac{d\varphi}{\sqrt{1 - k^2\cos^2\varphi}}.$$
Split the integral at $\frac{\pi}{4}$. The part
$$\int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \frac{d\varphi}{\sqrt{1 - k^2\cos^2\varphi}}$$
remains harmless as $k \to 1$ and tends to
$$\int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \frac{d\varphi}{\sin \varphi}.$$
For the other part, write $1 = \sin^2 \varphi + \cos^2 \varphi$ to obtain $1 - k^2\cos^2\varphi = \sin^2 \varphi + (1-k^2)\cos^2 \varphi$. Let $\varepsilon = \sqrt{1-k^2}$. Then
\begin{align}
\int_0^{\frac{\pi}{4}} \frac{d\varphi}{\sqrt{1 - k^2\cos^2 \varphi}} &= \int_0^{\frac{\pi}{4}} \frac{\cos^2 \varphi + \sin^2 \varphi}{\sqrt{\cos^2 \varphi + \sin^2 \varphi}\cdot \sqrt{\sin^2 \varphi + \varepsilon^2 \cos^2\varphi}}\,d\varphi\\
&= \int_0^{\frac{\pi}{4}} \frac{1 + \tan^2\varphi}{\sqrt{1 + \tan^2 \varphi}\cdot \sqrt{\varepsilon^2 + \tan^2 \varphi}}\,d\varphi \tag{$t = \tan \varphi$}\\
&= \int_0^1 \frac{dt}{\sqrt{1+t^2}\cdot \sqrt{\varepsilon^2 + t^2}}\\
&= \int_0^1 \frac{dt}{\sqrt{\varepsilon^2 + t^2}} - \int_0^1 \Biggl(1 - \frac{1}{\sqrt{1+t^2}}\Biggr) \frac{dt}{\sqrt{\varepsilon^2 + t^2}}.
\end{align}
Since
$$1 - \frac{1}{\sqrt{1+t^2}} = \frac{\sqrt{1+t^2}-1}{\sqrt{1+t^2}} = \frac{t^2}{\sqrt{1+t^2}\cdot (1 + \sqrt{1+t^2})},$$
the last integral remains bounded and tends to
$$\int_0^1 \frac{t \,dt}{1 + t^2 + \sqrt{1+t^2}}$$
as $\varepsilon \to 0$.
And the substitution $t = \varepsilon u$ gives us
\begin{align}
\int_0^1 \frac{dt}{\sqrt{\varepsilon^2 + t^2}} &= \int_0^{\frac{1}{\varepsilon}} \frac{du}{\sqrt{1+u^2}}\\
&= \operatorname{Ar sinh} \frac{1}{\varepsilon}\\
&= \log \biggl(\frac{1}{\varepsilon} + \sqrt{1 + \frac{1}{\varepsilon^2}}\biggr)\\
&= \log \frac{1}{\varepsilon} + \log 2 + \log \frac{1 + \sqrt{1+\varepsilon^2}}{2}.
\end{align}
Thus we have
$$K(k) = \log \frac{1}{\sqrt{1-k^2}} + O(1) = \frac{1}{2}\log \frac{1}{1-k} - \frac{1}{2}\log (1+k) + O(1) = \frac{1}{2}\log \frac{1}{1-k} + O(1).$$
In our specific case, with $k = \sin \bigl(\frac{\pi}{2} - \frac{\delta}{2}\bigr) = \cos \frac{\delta}{2}$, we have $\varepsilon = \sqrt{1-k^2} = \sin \frac{\delta}{2} = \frac{\delta}{2} + O(\delta^3)$, so
$$\log \frac{1}{\varepsilon} = \log \frac{2}{\delta} + O(\delta^2)$$
and overall
$$K\bigl(\cos \tfrac{\delta}{2}\bigr) = \log \frac{1}{\delta} + O(1),$$
where the $O(1)$ term is not only bounded, it in fact converges as $\delta \to 0$. We have the relevant terms:
$$K\bigl(\cos \tfrac{\delta}{2}\bigr) = \log \frac{1}{\delta} + 2\log 2 + \int_0^1 \frac{t\,dt}{1+t^2+\sqrt{1+t^2}} + \int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \frac{d\varphi}{\sin \varphi} + o(1).$$
Best Answer
Let us make the change of variables $t=\sin^2x$, $\displaystyle dx=\frac{dt}{2\sqrt{t(1-t)}}$ so that \begin{align} &K(k)=\frac12\int_0^{1}\frac{dt}{\sqrt{t(1-t)(1-k^2 t)}},\tag{1}\\ &E(k)=\frac12\int_0^{1}\sqrt{\frac{1-k^2t}{t(1-t)}}\,dt=\frac12\int_0^{1}\frac{(1-k^2t)dt}{\sqrt{t(1-t)(1-k^2 t)}}\,dt.\tag{2} \end{align} Then, using (1) and (2), we deduce that \begin{align} &k(1-k^2)K'(k)-E(k)+(1-k^2)K(k)\\ &=\frac12\int_0^1\frac{k^2(1-k^2)t\,dt}{(1-k^2t)\sqrt{t(1-t)(1-k^2 t)}}-\frac12\int_0^1\frac{k^2(1-k^2t)dt}{\sqrt{t(1-t)(1-k^2 t)}}\\ &=-k^2\int_0^{1}\frac{d}{dt}\left(\sqrt{\frac{t(1-t)}{1-k^2t}}\,\right)dt\\ &=0. \end{align}.
At the last step we integrated the derivative of a function vanishing at the endpoints.
P.S. If instead you would like to show your last identity, the idea remains the same: use that $$\frac{1}{(1-k^2\sin^2x)^{3/2}}-\frac{(1-k^2\sin^2x)^{1/2}}{1-k^2}=-\frac{k^2}{1-k^2} \frac{d}{dx}\left(\frac{\sin x\cos x}{\sqrt{1-k^2\sin^2x}}\right).$$