Classic momentum problems sometimes suppose two masses will stick together after a collision and move at same speed regardless of initial motions (such as one at rest, both travelling in same direction or opposite directions). When and why would two objects stick together after collision?
Things stick together for a variety of reasons. There could be a physical connection between the two bodies that resists the force of an otherwise elastic collision. For example, two train cars colliding could couple, and the coupling would be sufficient to prevent them from coming apart. Or, perhaps there are two bodies that are coated in glue or Velcro or something else that holds the bodies together.
Things also stick together because of deformation and an inability to transmit the rebounding force back through the colliding body. Imagine throwing an egg at the wall. As the gooey contents splatter on the wall, they deform and spread out, meaning there isn't really a single body to rebound anyway.
There are two different ways one can answer this question. First, as you have asked, objects sticking together in "classic momentum problems" and second objects sticking together in real life. I say real life because almost of all the "classic momentum problems" are some kind of unreal situations where there is no friction, colliding objects are undeformable and assumed to be perfect spheres. In such a case, that is, in "classic momentum problems", objects will stick together only because the person who sets up the question wants them to stick. Never giving any reason and never possible to predict beforehand.
However, if you are interested in why objects stick together in real life then you need to open the Pandora's box. There is many different mechanisms that can cause objects to stick and there are many different names for it; chemical bond, physical bond, adhesion, adsorption, absorption etc. and there are many different mechanisms; maybe they have opposite electric charge, maybe they are magnetic, maybe they are two oxygen atoms and the collision is so fast that they form oxygen molecule, maybe one of the objects is water molecule and the other is a hydrophilic material...