How I look at Yeerk evolution is by noting that, between Gedds and Yeerks, the relationship is actually
not a parasitic one. They have a true symbiotic relationship, beneficial for both species. The Yeerks get the Gedd's body, the Gedds get the benefit of the Yeerk's intelligence. Win-win.
What i wonder is how the ability to infest occurred in the first place. Its not like Gedds, or some other animals, or just lying down in the pools by the masses, long enough for generations of Yeerks to start retaining that trait...
Actually, they probably did exactly that. As I said above, it would actually be to the Gedds' benefit to be infested by Yeerks, since they're barely even self-aware otherwise. Thus, the Gedds that happened to fall down near Yeerk pools and get Yeerks in their ears would have an evolutionary advantage over ones that did not. Ergo, that trait would be selected for, and pretty soon you have a species that actively seeks out Yeerks.
Well they don't need intelligence, intelligence is high maintanaince and if you don't need it you won't evolve it. the reason smart people are stereotyped (Not necessarily accurately) as being weak on Earth is that intelligence fulfills the purpose of physical strength in industrilised societies in that it should enable you to earn more and have more children... if you're life is basically photosynthesising and swimming why evolve a brain?
By that same token, though; why not? It's true that intelligence is an expensive trait, yes. And it wouldn't be evolved for no reason. But the fact that Yeerks photosynthesize their energy means that they would be able to maintain the energy needed for their intelligence much more easily than a species that had to find and eat their food. And, FYI, Yeerks did not spend all their lives swimming. They spent their lives inside Gedds, so their intelligence was hardly wasted.
You simply cannot look at the Yeerks' evolution and the Gedds' evolution separately. As separate species, neither of them would have ever evolved. Just as flowers and bees would never have evolved if the other didn't exist. It's the
pairing between them that made both species possible. Yeerks, because they don't have to spend energy on finding food or developing a physical body, can devote all their energy to their intelligence. And Gedds, because they did not have to devote any energy to intelligence, could easily find food and develop their physical bodies.
Perhaps at one point in the Yeerks' evolution, which could be assumed to occur over millions upon millions of years, there were more types of species suitable for infestation on the Yeerk homeworld. Species which may have been more intelligent or physically capable than the Gedds. Then later on, some form of mass extinction wiped most of these other species out save for the Gedds, but the Yeerks still retained the ability to infest hosts.
That sounds very plausible. And that would explain why Yeerks can infest the wide range of species that they are able to infest.