depends on the glue, but basically think of when you dissove sugar in some water, and then you evaporate off the water and the sugar is left behind.
it's like that but usually the water is some kind of alcohol-like solvent and the sugar is a plastic or rubber like substance.
you put the glue on something, the solvent evaporates away and the residue sticks stuff together