Rotary files are used in endodontics to shape and clean root canals during root canal treatments. They are motor-driven and made of nickel-titanium, aiding in the efficient removal of infected tissue.