Earthing or grounding is done for safety of equipment and human beings.
The outer housing of electrical equipment is earthed by directly connecting it to a earth grid or earth electrode, thereby providing a low resistance path to ground. In case of a fault involving earth the live part of the equipment gets connected with the low resistance earth path. This produces high earth fault current and the protective devices in the circuit disconnects the circuit from the power source thereby reducing further damage to the equipment.
Neutral of electrical equipment are also earthed for equipment safety. Like, neutral of generators in power plants are earthed through Neutral Grounding Resistor to limit the earth fault current. Three phase transformer's neutral are earthed to provide neutral point to supply single phase loads like lighting and small appliances.
If a person touches an appliance which has an earth fault in it he will not get an electric shock as his body (standing on the earth) and the equipment's body are at the same potential provided the equipment is earthed properly. Thus proper earthing protects a person from getting electric shock.