Democracy has little chance of working outside of a homogenous society, in a sufficiently diverse society it will eventually descend into tribal politics.
People 'descend into tribal politics' when they feel the outlook for their society is worsening. That is the driving force that determines whether society considers itself homogeneous.
People accept most any system of government when there is optimism in the air.