How does grounding the circuit provide safety?
You cannot rely on an AC mains or high voltage DC feed being isolated. For this reason, any exposed metal (conductive) parts should be earthed because, if an internal wiring fault developed that connected "live" to those exposed metal parts, the fuse (yes a fuse or breaker is required for electrocution prevention) will blow and the live is disconnected upstream.

The fuse is much "weaker" than the ground wire so, after a short period of a few milli seconds the fuse blows and the device becomes safe. In that short period of time you can receive a small shock but probability suggests that this is an unlikely event.

A floating AC supply isn't that safe even to the touch due to capacitance to ground - a decent "tingle" can usually be felt.