There are several things going on that make the band-aid stick. This is true of almost any glue.
Mechanical adhesion is like Velcro™. Two rough surfaces have many little places that catch onto one another, like hooks catch loops.
Electrical adhesion is where one part of a molecule is positively charged, and it is attracted to the negative charges of another molecule. It is a form of chemical adhesion, where chemical bonds are formed between the glue and the surfaces that are being glued.
Atmospheric adhesion is like suction cups. Air pressure holds suction cups to smooth surfaces like glass.
To be a good glue, something must stick well to the surface it is applied to (this is called adhesion). But it must also stick well to itself (this is called cohesion). For example, water has good adhesion. You can wet two pieces of paper, and glue them together with just water. But water does not have good cohesion, and you can pull the pieces of paper apart, and water will remain on both of them, because the water did not stick well to itself.
In a band-aid, you want the glue to stick very well to the band-aid, and pretty well to itself, but you don’t want it sticking too well to the skin, or it will hurt to pull it off, and there might be some glue left on the skin that you would have to wash off later.
So band-aids have a special glue that doesn’t hold onto the skin as well as superglue would. But it holds onto the skin a little better than sticky tape used for paper would, so the band-aid stays on long enough to do its job.