For example:
"I had already done the shopping by the time she came home."
"I was late for work, by the time I arrived the client had already left."
The past perfect simple can be used to show how often something happened in the past.
For example:
I'd visited the city many times before.
It can also be used to express unfulfilled wishes or dreams. Sometimes called the Third Conditional.
For example:
"If I had won the lottery I would have bought a new car." Note: If I had done something I would have done something else.