In simple terms, you use it when you are referring to _two_ times in the past. The time when something happened, and a 'reference time'. You use the tense to establish the relationship between those two times.
The reference time can be explicit, or it can be implicit.