Firstly it should be noted that the subjunctive is a mood and not a tense, which means that use of the subjunctive should reflect how the speaker feels about what they're saying.
The subjunctive is used when there is an element of uncertainty in whatever is being said. For example, 'yo dudo que vaya' means 'I doubt that he will go'. In this sentence 'vaya' is in the subjunctive because if I am doubting that he will go, then I am uncertain that he will go. On the other hand, if I were to say 'I do not doubt that he will go' the subjunctive would not be needed because I am certain that he will go.
It is not always easy to tell when there is uncertainty and when there isn't. If I translate the phrase 'I hope that he will go' into Spanish, it might not be clear whether the speaker is certain or uncertain that he will go. But if I hope something then that does not mean that I am certain that it will happen; I merely want it to happen at some point. Therefore 'I hope that he will go' translated into Spanish is 'Espero que vaya', which uses the subjunctive.
In short, whenever uncertainty, doubt or possibility is being expressed the subjunctive should be used.