It is really difficult to see into Iran from outside, and the information that gets out seems terribly biased.
There are indications that there is a struggle going on, with Rafsanjani on one side and Khamenei on the other. I find it exceptionally difficult to identify Rafsanjani's side as the reformers, and while his side is the more articulate and the one which is expressing its views more passionately over the internet, I am not able to say that Rafsanjani's side is more popular.
I'm hopefully believing that the West is not a major factor in this confrontation. Iran's internal parties are certainly capable of producing a contest of wills like this without any outside direction. It is very difficult for me to believe Rafsanjani's faction would pursue foreign policies acceptable to the United States if empowered.
The West prefers paralyzing Iranian turmoil to either a clear Ahmadinejad victory or a clear Mousavi victory. Iran may be in a state of paralyzing turmoil, which may threaten to last for a prolonged period, so whether the US was involved or not, what we see is aligned with US preferences.
The fraud investigation initiated by Khamenei will give one side a somewhat face-saving way to step down. I'm not sure which side it will be, my guess is that this is being negotiated behind the scenes now. Mousavi was allowed to attend a rally today. We are not in a state of maximum hostility.
Hopefully, but also likely, all parties involved recognize that they are Iranians first and are reaching a compromise that is better for everyone than a major disruption of national life. But these efforts to reach compromise are far outside of what anyone who is not an establishment Iranian power-broker would be able to perceive.