Electron detectors work by capturing electrons emitted from or transmitted through a sample. These electrons can be secondary electrons, backscattered electrons, or transmitted electrons, depending on the type of microscope and the mode of operation. The captured electrons are then converted into an electrical signal, which is processed to form an image or spectrum.