As electric charge builds up on an isolated object, the potential difference between it and the Earth (at 0V) increases. The p.d. causes an electric field between the object and the earth/earthed conductor. This electric field causes electrons in the air particles to be removed (aka ionisation). Air is normally an insulator, but when ionised it is much more conductive. Therefore, if the p.d. gets high enough, electrons can jump across the gap between the object and the earth– a spark. Electrons can also jump between a charged object and any earthed conductor nearby.