The underlying mechanism for Zipf’s law is not yet agreed on but the main hypothesis is that it’s an outgrowth of the Principle of Least Effort. In short, systems that survive and operate at steady state optimize for efficiency. When they do, things tend to look like Zipf distributions.