When can lands be tapped?
You can tap lands for mana at almost any time. Pretty much any time you could do anything else, anyway. Among other things, you can tap land for mana any time you want to play a spell or ability and you need mana to do so.

You can only untap a land when you untap your other cards during YOUR untap step (or if a spell or ability instructs you to untap a card). So no, you cannot untap your lands after each phase when the mana they produced goes away, or during your opponent's untap step.

So without getting into the specific details of the comprehensive rules, which would just cause confusion for beginners, what you really need to know is that you can tap a land any time you need mana, and your lands will normally only untap at the beginning of your turn.

Relevant rules from the Basic Rulebook:

Under "Casting a Spell"


  Now check what the spell’s cost is. Tap your lands to 
  produce the mana necessary to pay that cost, and pay it.


Also note that mana will empty from your mana pool at the end of every step, not just at the end of each phase. Each phase is divided into multiple steps.