Why are there ecosystems?
Basically, they don't. Ecosystems are pretty much either de facto, delimited by geographical boundaries, or defined by us. For example, an underground lake would be an ecosystem and it is organized in such a way for the simple reason that there is no communication between it and any other system. 

Most ecosystems however, do communicate. For example, we call a desert an ecosystem but what of creatures living in the borders? That can survive both the harsh desert and the milder outskirts. Do they belong to the desert ecosystem? To the surrounding one? To both?

Basically, we divide nature into ecosystems because we can study them better that way. Species that form part of the same ecosystem tend to interact in one way or another and species from completely separate ecosystems tend not to. This is not some kind of rule however, it is simply the way we categorize things.

To take a different example, how would you define a city? Where does a city end and the countryside begin? Ecosystems are similar, there are seldom very clear cut lines separating them, they sort of bleed into one another.

In other words, your question is moot, ecosystems don't really self organize as such. The organization that does exist is between the different species and is an emergent quality of the complex system that is the ecosystem. Thinking of ecosystems, however, as distinct and well defined entities is generally wrong.