I have a whole lot of misconceptions about electricity, and this is one of them. I don't get why the earth wire works; not how, but why. My understanding is that one end of the earth wire is connected to the metal casing of an electrical appliance, so that in case the live wire is in contact with the metal casing and there's current flowing through the metal casing, the earth wire provides a low resistance path to the Earth.
That way, there isn't a danger of getting electrocuted when you touch the metal casing even if the current leaks, because the current is flowing through the earth wire, down to the Earth.
But then I also heard that a circuit needs to be completed in order for an electric current to flow. But in the case of the earth wire, the current is just going into the ground, but it isn't going back to source of the circuit. In that case, why does the current flow through the earth wire in the first place, if it's sort of like a "dead end" and doesn't complete the circuit?