It’s just the nature of electricity to move from an area of higher voltage to an area of lower voltage, if given a path to travel there. The ground is simply the lowest-voltage area around, so if you give electricity a path to the ground, it will take it, no questions asked! When electricity goes into the ground, the earth absorbs its energy.