Other insects that land on the plant, or vertebrates that might try to graze on the leaves, are attacked by the ants. So the plant gains protection, in return for providing the ants with places to live and with food. Ants are generally predacious. These ants form huge colonies. This is an example of mutual exploitation or mutualism.
Termites are social insects closely related to roaches.
Termites have special communities of protozoans living in their guts that help them digest cellulose. One of the things that must happen when a termite egg develops is that it must obtain from others in the colony these specialized protozoans. In fact, every time a termite larva molts, it sheds the lining of its gut as well, and needs to get re-supplied with protozoans. Adults excrete a special substance that contains the symbionts and feed it to the larvae. The bacteria live in nodules in the plant roots.