What factors should be considered before doubling pawns?
Jeremy Silman, author of many books on chess strategy (as well as my favorite endgame book) always pushes not thinking in terms of static strengths - having a bishop over a knight - vs. weaknesses - having doubled pawns - but rather in terms of imbalances.  After all, in a closed position, a knight will do better than a bishop, and you mentioned yourself one way doubled pawns can actually be an advantage.

So, the questions you should really be asking yourself are, What are the imbalances in the position?  What new imbalances will this capture create?

For doubled-pawns, the common imbalances are:


Material.  Since you must capture to get doubled pawns, you'll be gaining (or recapturing) material.
Space.  As you mentioned, moving the pawn out of the way opens a file/diagonal for your pieces.
Central (key square) control.  When capturing towards the center, you'll now have an extra pawn to attack the center - or, when capturing away from the center, you lose some of that control.  Note that if the capturing pawn is a central pawn, you may gain more central control, due to the open file/diagonal.
Also, later in the game other squares may become important to control.  You should take these into consideration as well.
Pawn Structure.  Doubling your pawns tends to weaken your pawn structure, especially if they are isolated.  Doubled-isolated pawns are easy targets for your opponents, so expect to lose at least one of those pawns later.


Lastly, and most importantly, it's rarely a matter of a single move, meaning other imbalances will come into play as well.

If I move here, there's a possibility he'll move here, leading to a series of moves in which my pawns will be doubled and he'll gain the double-bishops, but I'll have the initiative.

In every line of play, existing and potential, you will always need to compare the imbalances that favor you to the imbalances that favor your opponent, and ask yourself:  "Do the imbalances in the position favor me over my opponent?  How do I make the existing imbalances favor me even more?  Can I create even more favorable imbalances for myself in this position?"  Learning how to answer these questions is one of the most important skills in getting better at chess.