That effect is caused by particles that behave like magnets. The particles are too tiny to see.
Everything around us is made of these little bits. One kind, the electron, has a negative charge. It behaves like the south pole of a magnet. The other kind, the proton, has a positive charge. It behaves like the north pole of a magnet. Like the opposite poles of two magnets, the two types of particles are attracted to each other.
In most things, the electrons stay close to the protons, forming bigger particles called atoms. So the positive and negative charges are in balance. But when you rub a balloon on your hair or certain kinds of clothing, the balloon pulls some electrons away from the protons in your hair or clothes. Then the balloon has extra electrons that are "static," which means they are staying in one place. We call this state static electricity. When you put the balloon against another object, the extra electrons pull on the protons in the other object, and the balloon sticks.