Their small size allows them to occupy a wide range of habitats other animals are unable to take advantage of. Insects' hard, waterproof outer shell or exoskeleton is a major contributor to their ability to live practically anywhere. To some extent, the exoskeleton protects insects from changes in their environment. In addition to their small size, insects' body structures are incredibly diverse and highly adapted to their environments. For instance, aquatic insects often have gills or other special structures that allow them to breathe underwater.
Insects also feed on almost everything.
There are insects that feed on nectar and pollen from plants. There are insects that feed on the leaves of plants that are poisonous to all other animals. Some insects feed on the blood of mammals, while others feed on the feces left behind by those mammals. Like termites, some ants even eat wood. Another important factor that probably contributes to insects' success is their ability to reproduce quickly and in great numbers.