AFM works by scanning a sharp tip over the surface of a sample to measure forces between the tip and the surface. This technique allows researchers to visualize and manipulate atoms and molecules with high precision. AFM can also be used to measure mechanical properties like stiffness and adhesion at the nanoscale.