Osmium tetroxide works by reacting with the double bonds in unsaturated lipids, forming a black deposit of osmium that provides contrast in tissue samples. This reaction helps to stabilize the lipid structures, making them more visible under the microscope.