Rub a balloon on your hair and press it against a wall.
Sometimes it stays there.
There is no glue involved.
Static electricity is doing the work.
Rubbing can transfer electrons
Different materials hold electrons with different strengths.
When two materials rub together, electrons can transfer from one surface to the other.
The balloon can end up with an excess electrical charge.
Your hair may be left with the opposite charge, which is why strands can repel one another and stand up.
The wall starts out neutral
A normal wall has positive and negative charges balanced overall.
But those charges are not perfectly frozen in place.
Bring a charged balloon close and the electric field can shift the distribution slightly.
Charges opposite the balloon move a little closer to the surface.
Like charges shift slightly farther away.
The closer opposite charges win
Electrical force becomes stronger at shorter distances.
Because the opposite charges in the wall are now slightly closer to the balloon than the like charges are, the attractive effect can be stronger than the repulsive effect.
The lightweight balloon gets pulled toward the wall.
This same world of charge and voltage is why birds can sit on a single power line without being electrocuted, although the electrical situation there is very different.
Why does the balloon eventually fall?
The extra charge does not stay forever.
Electrons gradually leak away through the air, your hands, the wall, and other materials.
As the charge weakens, the electrical attraction may become too small to support the balloon.
Gravity finally wins.
Why does humidity matter?
Moist air and thin films of water on surfaces can allow charge to leak away more quickly.
That is why static-electricity tricks often work better in dry air.
It is also why static shocks are more common in winter.
Is the wall becoming permanently charged?
No.
The charge distribution is mostly a temporary response to the nearby balloon.
Once the balloon moves away or loses its charge, the wall returns toward its normal distribution.
So there is no glue.
Just electrons rearranging themselves long enough to make a balloon look surprisingly competent.
And that’s the short explanation.
Related explanations: Why do static shocks happen more in winter?, Why can birds sit on power lines?, and Why do magnets attract iron?