I want to ape Ming dynasty China for my setting. Key points are that there's a big empire, several centuries old, but hereditary transition of power is practically non-existent. Instead, the country's youth is taking imperial exams, and the ones with the best results can join the bureaucracy and serve in various government positions. Now rich families are able to drill their children better and will have proportionally better odds at landing good jobs, but there's still plenty of social mobility; and nobody considers power extending beyond the borders of one's home as something given by birthright.
The first difference with China is that the job on top is not hereditary either; the Philosopher-Emperor is a Plato-ish figure who is chosen from the wise people who have not become officers; the idea being that only someone not interested in rulership should be allowed to rule. And they're not a spiritual leader either, or a holder of the Mandate of Heaven, or something along supernatural lines. The position of Philosopher-Emperor is also considered meritocratic: someone gets it because they, individually, deserve it.
And the second difference with China is that the country is completely multicultural. Of course there's multiple cultures in China but the Han are by far the majority. Here, there's one culture with about 25% of the people, a couple with 10-15%, and whole bunch of tiny ones; a few hundred in total, all of whom have no native language in common. New cultures are occasionally subjugated and become part of the empire; and every now and then a different culture becomes the dominant one for a few centuries, about at the rate dynasties change in China. This extends to religion too: there's a pluralistic approach to divinity in general. There are too many gods to count (with new ones joining the pantheon when a new culture enters the realm) and no one agrees on which one is the head god - or if there even is one.
Multicultural countries have had quite a struggle throughout world history. Even in these enlightened times, ethnic warfare is common. One way to keep different people together is totalitarianism, but these are the Late Middle Ages; no secret police yet. And another is the concept of the divine right to rule - which is ruled out by the pluralistic religion. I'm not interested in making the empire into a democracy either.
So why has this empire not fallen apart yet? What reasons can tens of millions of people have for trusting in a system, without the threat of violence in this life, or of suffering in the afterlife? I would be interested in historical examples of multicultural societies that did not consider their ruler divine, but any reasonable suggestions will do; I'm willing to suspend my disbelief a little
Other factoids:
None of this has to be perfect. Some cultures are not as respected as others, the upper classes are rather corrupt and the philosopher-emperor is not nearly as wise as he used to be. The thing is that people can still believe they live in a meritocracy, and they don't have to be utter fools to do so. The empire just has to be stable for over half a millennium.
There is no 'state culture' (e.g. Han for China, Latin/Greek for Rome); there's just some cultures that are larger than others. Religions, languages, diversity is fine (perhaps even seen as moral). There is however a state philosophy/morality, supporting the whole ideas of meritocracy and pluralistic divinity. If a culture has a god who claims they are the only god, or believes in birth right, then they're laughed at. Of course that means that this is not perfectly multiculti, but as said it doesn't have to be.
The exams lean towards cultural agnosticity; they study a range of texts from different backgrounds. Honouring the many gods is also part of the curriculum - and so are skills such as calligraphy (there's only one writing system), mathematics/geometry, history, and the aforementioned state philosophy. The material can be called coloured by the ruling class but it is not solely about that ruling class; that's where my line is.