Static electricity is caused by the transfer of electrons between substances right? For example, take a balloon and your hair. Both are stable and electrically neutral. So why would electrons jump from the balloon to your hair?
A heuristic account of why this is can be found in the triboelectric series, which is a small list of materials along with their tendencies to become positive or negatively charged when rubbed in contact with each other.
As is briefly explained in the article and on this webpage, part of the reason why this series is in the order it happens to be in has to do with the electron work function of the materials. Materials with large work function hold on to electrons more strongly, and thus energetically are the preferred holders of an excess charge in a situation where charges are separated (due to either friction, pyroelectricity, or other means).
One way to visualize the process is as if you are pulling an electric dipole apart. When two dissimilar work-function materials are put in contact, electrons at the interface will tend to be drawn towards the material with the higher work function, generating a temporary dipole. When the materials are separated, the dipole is also separated, resulting in a pair of negatively and positively charged objects.