There are 7 billion humans and around 200 billion birds in the world. That seems like a lot of two-legged animals, but non-human mammals number around 500 billion, and almost all of them are four-legged. And according to some studies, there might be another 10 trillion reptiles and amphibians. So the mean number of legs for land vertebrates is very close to 4 (it's actually about 3.96). Fish don't have any legs of course, and there are another ten trillion of those, so including them brings the average back down to 2.
But this is only for vertebrates. What if we included invertebrates as well? We can ignore starfish, octopuses, spiders, and centipedes: they have lots of legs each, but there just aren't enough of them to affect the average. But there are an estimated 5 million trillion (5×1018) insects. And in the sea, there are at least 20 times as many copepods – zooplankton with between 6 and 10 legs each.
In the end, though it makes no difference because all of them are outnumbered by the humble roundworm. Nematodes are mostly microscopic, but they're multicellular and so count as animals, and they are found in high densities in virtually every Earth ecosystem. The 10 billion trillion nematodes in the world drag the mean number of legs down to less than 0.1, which means that on average, animals don't have any legs at all!