How do insulators work?

It depends on what kind of insulators you are referring to. The ultimate purpose of an insulator, regardless of application, is to prevent or impair the conduction of energy.

Thermal insulation works primarily by trapping pockets of air in a cohesive layer of material (fiberglass or foam, usually) to prevent the movement and conduction of heat.

Sound/Vibration insulation can be similar to Thermal insulation, but can also make use of elastic or absorptive materials, like rubber or springs, that absorb sound and vibrations, again, to prevent the conduction of energy.

Electrical insulation is usually accomplished by using non-electrically conductive materials, like glass, some ceramics, some rubbers and plastics, to coat or isolate whichever electrical conductor is in question. This prevents the electrical energy from being conducted to undesirable locations.