How does household glue work? How does it attach to almost any other compound? Thanks.
At a microscopic level most of the materials have many microscopic pores with different diameters and shapes, so in most of the cases any non solid material which can harden and which has the ability to go inside the tiny pores can be a glue of a determinate strength simply hardening inside the pores. This is called mechanical adhesion.
Furthermore the adhesion can be favored if some bonds between the molecules are formed so some glues are more effective for some sort of material. Generally van der Waals' force occurs spontaneously between compound with dipoles, this is called dispersive adhesion.
Hydrogen bonds can increase the strength of the glue. Covalent bond between glue and materials don't occurs often, I think that cyanoacrylate (super glue) probably form a covalent bond with the hydroxilated surface of the material (but nobody seems talk about this). In fact a real surface is always cover by other compounds so is very difficult that something interact directly with the surface, and this is why you should always clean (and in most of the cases dry) the surface before apply the glue.
There is glue (sets) and there is adhesive (stays sticky). Glue is a fluid that wets both surfaces, then sets to a solid by solvent evaporation, reaction, or melt solidifying. Solvent and melt glues are primarily mechanical bonds, especially for porous surfaces. Reactive glues can be chemical bonds as well (resorcinol carpenters glue by oxidation, isocyanate Gorilla glue by nucleophilic attack, Super Glue by free radical grafting). Solvent alone can weld plastic surfaces, such as cyclohexanone for vinyl (plasticized or filled PVC) or organic solvents in general for acrylic, polycarbonate, polystyrene, ABS, etc.
Failure of bonded surfaces can be through adhesion (interface separates) or cohesion (material separates).