The last time I looked at the Arab Spring I was not particularly hopeful of the prospects of the revolution resulting in a democratic form of Government.
About two years on the situation in Libya seems quite dreadful so at least one conclusion is clear: a repressive state is probably better than complete anarchy. Neither is desirable but in a repressive state ordinary citizens are only under threat from the state and its agents.
In a situation where the state collapses through a popular revolution there are likely to be many different militias competing for power. Unless one group is firmly in charge, citizens may be under threat on several fronts instead of from one monolithic entity. Services collapse and with no one to hold the ring, things degenerate into a free-for-all.
Therefore the crucial factor is some form of orderly transition. Ideally a dictator should be deposed in a backroom deal, where he or she leaves quietly and a transitional leader takes over. How can this be engineered?
The problem is that dictators are deaf to the concerns of the public and resist any attempts at correction. Unrest mounts, frustrated people take to the streets and the resulting mass revolution brings too many actors and competing interests to the table.
Bad leaders need to be persuaded to leave quietly, more sane advisers within the inner ruling circle need to read the signs and work together to persuade a ruler to leave. This is what seems to have happened in the transitions in Eastern Europe. (see also here)
One deposed, the trickier process of institution building must begin.
The liberty of citizens can only be guaranteed by institutions, but building these from scratch can take, literally a generation or two. It is possible to build them faster, depending on the extent of any foundations that may exist, the best being any left in the wake of the British Empire.
The attitude of the people will also help. A friend once explained that he felt that the people of Eastern Europe looked to Western Europe as a model and were willing to accept Western European help in building institutions.
Their people were not distracted by devious rulers proclaiming "monarchical democracy", "no party democracy" or some mysterious "Asian Way". These distractions need to be identified and countered early and constantly, to focus public opinion on the real issues of liberty and governance. Education, beginning initially with the elites, who may be woefully ignorant, is a must for this to be successful.
Transitioning from dictator ship is a complex and delicate process that is all too easy to get wrong. Identifying competent people who can persuade the leader to go and serve in a transitional government; a commitment to institution building, with outside help if necessary are factors that can make a crucial difference to the ultimate outcome.