TEM operates by directing a high-energy electron beam through an ultra-thin sample. The electrons interact with the atoms in the sample, resulting in various scattering phenomena. Detectors capture the transmitted electrons, forming an image. The contrast in the image is due to differences in electron density and thickness of the sample, allowing researchers to visualize fine structural details.