If the neutral bar is connected to literal ground, why doesn't all electricity flow into the ground? Consider a single phase system with 2 wires coming from the transformer, one hot and other neutral. These 2 wires are connected to my main box. The hot wire is connected to the breakers, then leading to a live pin of sockets. The neutral wire is connected to the neutral bar, and then connected to the neutral pin of sockets.
A green ground wire connects the ground pin of socket to the neutral bar. A wire connects the neutral bar to the literal ground in my garden. Why does not all electricity go into the ground?
 A: EE here. Grounding systems always throw people for a loop but they are pretty simple. Fault current only flows into the ground path if a hot conductor is accidentally shorted to something connected to ground. Keep in mind that most metal surfaces of any household device will be electrically connected to ground. Inside the high side of a transformer in any device the neutral and ground should NOT be bonded. This will cause a portion of line current to regularly flow through the ground. Low side of transformers can (and often are) bonded to neutral, since it's electrically isolated from the high side neutral through the magnetic coupling of the transformer.
Full load current does not flow into the ground under normal circumstances. There is only one point in a household where the ground conductor is connected to the neutral, and that's at the service entrance (in North America).
Proper grounding provides the fault current an alternate path to flow through (instead of something else, like your body) when you, or another object is in electrical contact with a surface that has been shorted to live power.
It's a little annoying to see this topic incorrectly covered on the internet a lot. Remember that the ground wire isn't even the same wire gauge as the neutral or hot wire, so it's not intended to normally sustain full load current.
Also side note: your circuit breaker will protect against any short circuit current (order of magnitude about 10kA), regardless if it flows through ground or neutral.
A: The answer to this is that electricity does not always take "the shortest path to ground."  That phrase is an oversimplification that can be useful, but in this case is not.
A more correct statement is that electricity flows from a high potential to a low potential.  In the case of the power to you house, that means it travels in a loop between the power company and your house. That loop happens to have a single point where it connects to the "ground" under your feet, but that doesn't make a loop.
Well, it kinda does.  The power plant is on the ground too, so in theory there are two parallel connections.  One goes through one wire into your house, exits, and returns on the other wire, and the other goes through one wire into your house, exist, and then heads out to the "ground" and travels to the power plant along that path.
In reality, both paths are followed, all the time.  However, the resistance of the ground between you and the power company is far larger than that of the wire, so the vast majority of the current travels through the wires.
A: I think the ground is connected to the neutral busbar in case there is a break of the neutral wire further than the consumer unit. It also provides a low resistance earth for the earth busbar if it is separate because the distance current travels through the soil is less: in the event that only the earth bar is grounded, it could take an unpredictable route back to the transformer, whereas travelling to the grounded neutral right next to it is a short path.
In a normal situation, ground current will mostly take the neutral route at the busbar and not the earth. It is split according to the resistance of the neutral wire and the resistance of the earth wire + soil – the other end of earth is connected to neutral at the transformer, so it still ends up flowing full circuit into the transformer (current is drawn from the soil that dissipates into the soil at the other end). Of course, resistance of the neutral wire is less than the soil, so most travels over the neutral wire. The ground bar can be directly connected to the neutral busbar instead of through the soil except for when you have an RCD, the ground busbar is either not connected to the neutral busbar and ground current always flows to earth, allowing the RCD to work properly, which it wouldn't if ground current flowed over neutral and not elsewhere, or the RCD is connected before the earth busbar link to the neutral bus bar.
