Electricity always seeks to equalize between areas of high and low voltage. Because the earth is at zero voltage, this means electricity will always seek the ground. When electricity flows to the ground, this is known as grounding.
If electricity is given a path, it will always move from a high-voltage source to a low-voltage area until the voltage equalizes. This is why, during a storm, lightning tends to strike the tallest conductive object around. Lightning is simply the voltage equalization of the sky and the ground through the easiest path available.