how things get charged by rubbing on hair ?
The charge is nothing but static charge.
This due to static charge build up that occurs as electrons gets swapped from one material to another. Rubbing provides energy (in the form heat due to friction) to the electrons of one material and they jump out and get transferred.