How exactly do ear tubes prevent further ear infections?

It opens air flow. A main factor in recurrent ear infections is the build up of thickened mucous in the middle ear. This weeps off the walls of the space and should flow thru the eustacion tube to your throat. Recurrent infection may thicken the mucous & if it never flows out, germs love it. The tubes provide a window in the ear drum so air can get in & mucous can drain out. With the mucous is gone, no food for germs.
Permit drainage. Ear tubes allow the inner ear canal to drain. Once child is older and the ear grows then more natural drainage can occurr.
Allow fluid drainage. They prevent fluid, which has the potential to become infected, from building up behind the tympanic membrane.