Bed bug sprays are highly effective because they contain a substance that reacts with a chemical compound on the insect's outer shell, causing it to perish in about an hour.
The spray typically contains pyrethrin derived from the chrysanthemum flower and is ten times more effective than DDT in laboratory tests. Pyrethroid insecticides have some drawbacks, too: they don't stay on surfaces for as long or affect bed bugs' ability to make new eggs.
Insecticides usually work by affecting the insect's exoskeleton and either killing them by drying them out or irritating their systems sufficiently that they are washed away.
That is why you will often find warnings on the label to ensure no children or pets are in the room while you spray, as these could easily be harmed if they are rubbed up against treated surfaces after being exposed. Bedbugs aren't generally harmful to humans, but it doesn't hurt liberally spraying down your bedding just in case!
The same applies to any seemingly inert surface such as furniture or walls - make sure there are no animals around before spraying those too!