The range of a dragless projectile fired at angle $\theta$ above the horizontal with an an initial height can be written non-dimensionally as:
$$R^* = \cos \theta \left (\sin \theta + \sqrt{\sin^2 \theta + 2 / Fr}\right)$$
where $R^* = R g / v$, $Fr = v^2 / (g y_0)$, $v$ is the initial velocity, and $y_0$ is the initial height.
(Derivation is available on Wikipedia, in a different notation than mine here. I use dimensionless notation to simplify the equation.)
The firing angle which maximizes the range is also given on Wikipedia and elsewhere, but I am unable to derive it aside from a special case ($y_0 = 0$). In my notation, the optimal firing angle can be found from:
$$\sin^2 \theta_{max} = \frac{Fr}{2 (Fr + 1)}$$
Differentiating $R^*$ with respect to $\theta$ is simple enough, as is using the result above to check that the $d R / d \theta = 0$ for the optimal angle. That proves the result. But how do you derive this in the first place? My own attempts at solving $d R / d \theta = 0$ for $\theta$ get lost in a mess of trigonometric functions, and I'm interested in seeing how one cuts through that mess to get the result.