Many socio-economic factors lie behind the rise of Ahmadinejad, who draws much of his support from the poor. But its worth considering what responsibility the west, in particular the US, might have for this unhappy turn of events.
Iran's nascent democracy was overthrown in the 1950s by a US-backed coup and replaced with a dictatorship just as brutal as the current one. Amnesty International reported in 1976 that under the Shah Iran had the "highest rate of death penalties in the world, no valid system of civilian courts and a history of torture" which was "beyond belief". In Iran "the entire population was subjected to a constant, all-pervasive terror".
In the present day Iran is surrounded by countries with US bases on their soil. Its been attacked, to brutal and devastating effect, by a US-backed Iraq in recent history, where banned weapons were used by the aggressor. Its regional rival, Israel, a nation kept on life-support by the US, boasts a nuclear arsenal which it claims as its exclusive right, along with the right to steal and hold on to its neighbours' territory by acts of violence.
So Iran as a nation has some very good reasons to feel embattled and threatened from all sides. And of course, feelings of national persecution create the perfect conditions for terrifying figures like to Ahmadinejad to emerge. In other words, continued US aggression is helping to deter reform in Iran, exactly contrary to what Washington pretends is its policy aim: spreading democracy.
Of course, genuine democracy in Iran, or anywhere else in that region, is the last thing the US wants. That would produce independent minded governments wishing to spend oil revenues on economic development to build modern societies for themselves. The US sees the role of MidEast oil rather differently; as providing a source of enrichment for US corporations and complient local elites, and to help maintain a strategic stranglehold on the world ecnomomy.
If the election results benefit the hardliners this could help Washington's neo-cons create the opening they have been desperately trying to manufacture in order to take military action against Iran, and install another vicious client government there. We can only hope that the Iranian voters don't take the bait, and that a way can be found to break the cycle of repression and disenfranchisement in that blighted country