Fingerprint scanners work by optically or capacitively scanning fingerprints and analyzing unique ridge and valley patterns called minutiae. Optical scanners use charge-coupled device sensors like digital cameras to capture fingerprint images, while capacitive scanners detect ridge and valley differences electrically. Both create images of the fingerprint pattern, which scanner software then analyzes by measuring relative minutiae positions and shapes, similar to recognizing constellations, to determine if it matches fingerprints on record.