What's the benefit to Russia to fight on behalf of Iran? what does Iran give them in return?
Fighting on their behalf, not really. As an arms supplier, energy export partner, and benefactor?
If Russia can convince isolated states like Iran that they're a reliable counter to the US, they'll come running with money in hand. I'm sure Iran wouldn't mind putting their F-4s on sticks and getting some nice shiny Flankers instead.
Syria has been a Russian ally for a long time - intervening on their behalf makes good political sense. Plus, it's a stick in the West's eye. I read one analysis that said Putin can't solve the problem in Syria, but he's now ensured that no one can leave him out of the process, either.
Of course, that's assuming they can pull it off. There's a lot of doubt about Russia's ability to sustain a deployed campaign for any length of time. It's expensive, and the ruble's value has dropped by half in the last year. It's technologically difficult, and the Russian armed forces don't have the training or experience doing it. So if in three or four months the Russians have to fold their tents and go home without decisively putting down the Syrian opposition, it will have been a wasted effort.