This is a practical oversimplification which will be right most of the time. For more detailed information see Mastery of the Tenses!
For an action previous to another past action.
- I had eaten before you came.
- Had you met before you started university?
- This morning I got dressed after I had showered.
To emphasise an earlier past.
- It was then she realised that they had met before.
- He was angry but I had warned him!
- By the time I arrived, she had left.
For reporting actions in reported speech.
- I said that we had eaten.
- You asked if she had seen the film before.
- They thought they had told you already!
For sequencing two related actions, use Past Simple if the actions are to be considered 'close', Past Perfect to emphasize separate steps.
- Once he (had) finished the report he went home.
- After I (had) studied the chapter I tested myself.
- As soon as they (had) arrived, they unpacked their suitcases.
Conversely, if two 'close' actions need to be separated (because we feel they are unrelated) we use the Past Perfect to emphasize that the first was completely finished.
- When I had tidied the house, I relaxed.
- Once I had prepared all the dinner, I got ready myself.
Used in IF clauses to describe hypothetical situations in the past.
In the IF clause of Third Conditionals.
- If I had seen you yesterday, I would have said hello.
- If they had won the match, they would have won the league.
In the IF clause of Mixed Conditionals
- If she hadn't told you, you wouldn't know anything about it.
- I would speak Russian, if I had been born in Russia.