Reasoning behind the trigonometric substitution for $\sqrt{\frac{x-\alpha}{\beta-x}}$ and $\sqrt{(x-\alpha)(\beta-x)}$
In the first place, one notices that the expression can be "normalized" by means of a linear transform that maps $\alpha,\beta$ to $-1,1$, giving the expressions
$$\sqrt{1-x^2}\text{ and }\sqrt{\frac{1+x}{1-x}}=\frac{1+x}{\sqrt{1-x^2}}.$$
Then the substitution $x=\cos\theta$ comes naturally. We could stop here.
Coming back to the unscaled originals, we have
$$x=\frac{\alpha+\beta+(\beta-\alpha)\cos\theta}2$$
which is also
$$x=\frac{(\alpha+\beta)(\cos^2\frac\theta2+\sin^2\frac\theta2)+(\beta-\alpha)(\cos^2\frac\theta2-\sin^2\frac\theta2)}2=\alpha\sin^2\frac\theta2+\beta\cos^2\frac\theta2.$$