The force that resists the separation of two bodies in contact is called adhesion. It arises from attractive interactions at the interface between different materials, such as glass and water or tape and paper.
At microscopic scales, adhesion can involve intermolecular attractions, chemical bonding, electrostatic effects, and—in some cases—mechanical interlocking between surface irregularities. The smoother and cleaner the surfaces, the more significant these interactions can become. Adhesion is also why water clings to the sides of a glass and why a gecko can grip a wall.
A common mix-up is cohesion, which describes attraction between molecules of the same substance. Water molecules attract one another through cohesion, while water sticking to glass demonstrates adhesion. Friction is related but different: it resists sliding motion, whereas adhesion specifically describes attachment and resistance to pulling surfaces apart. In engineering, the force needed to separate joined surfaces is often described as adhesive strength.