Static electricity is caused due to the separation of positive and negative charges. Electrons (which is negetive in charge and moves very fast) moves from one medium to another which leaves excess positive charge on one object and equal negative charge on another object.