A definite pronoun must refer clearly to a specific antecedent.
Generally, you can avoid errors of pronoun reference by avoiding unclear pronouns, especially at the beginnings of sentences. It and this make for weak subjects.
1. She was popular with all the students, but fortunately it did not make her conceited.
To what does it refer? Change it to her popularity, or rewrite the second clause: but fortunately she did not become conceited.
2. He removed the books from the shelves in order to clean them.
What did he clean, the books or the shelves?
Correction: After removing the books, he cleaned the shelves. Or: He cleaned each book after he removed it from its shelf.
3. I spent all my money at the Nice ’N Easy, which meant I couldn’t afford to pay my phone bill.
The word which refers to the entire preceding clause (not just the Nice ’N Easy) and is therefore vague. Re-subordinate this sentence: Because I spent all my money at the Nice ’N Easy, I couldn’t afford to pay my phone bill.
4. She was intelligent and hard-working. This, to my surprise, did not help her grades.
The words intelligent and hard-working are not proper antecedents for the pronoun this.
Try: These qualities, to my surprise, did not help her grades.
5. In Milton’s Paradise Lost, he explains the purposes of evil in the world.
Since Milton’s is an adjective, the he has no antecedent.
Correction: In Paradise Lost, Milton explains...