We use the past simple when we are talking about an event that happened at a particular time in the past or about something that continued for some time in the past. We use the present perfect to express that an action began in the past and is still going on or has just finished.
Have a look at the diagram:
Note that, when adverbs such as never, just, already... are added to the past perfect sentences, they are placed between had and the past participle:
When Jane went to see the elephants, she had already seen the lions.