What the plus-que-parfait marks
The plus-que-parfait is the tense for an action that had already finished before another moment in the past. English uses the same shape for it: had plus a past participle. Elle avait beaucoup travaillé avant de pouvoir jouer le morceau parfaitement ("She had worked hard before she could play the piece perfectly") keeps the working and the playing on two different rungs of the same past.
That is why the tense rarely stands alone. The later event normally arrives in the passé composé or the imparfait, and Lingolia frames the plus-que-parfait as the form for faits, situations et actions qui ont eu lieu avant le moment du passé que l'on raconte, the things that happened before the past moment being narrated.
Lawless French adds a condition that the conjugation rules alone do not cover: the two verbs have to be connected. The earlier action should have led to the later one, or had some bearing on it. Two events that are merely listed in order keep the passé composé, as in J'ai fini tout le travail et puis je suis parti ("I finished all the work, then I left"). Finishing and leaving are sequenced, not related, so the past perfect is not needed there.
How the tense is built
Build it in two pieces: avoir or être conjugated in the imparfait, followed by the past participle of the main verb.
Larousse's conjugator gives both auxiliary paradigms in full. Avoir runs j'avais, tu avais, il/elle/on avait, nous avions, vous aviez, ils/elles avaient. Être runs j'étais, tu étais, il/elle/on était, nous étions, vous étiez, ils/elles étaient.
Regular participles follow the same three endings as everywhere else: -er becomes -é (aimer, aimé), -ir becomes -i (finir, fini), -re becomes -u (vendre, vendu). Irregular participles have to be learned verb by verb, and the French past participle guide covers the accent and agreement oddities among them.
So j'avais mangé is "I had eaten" and elle était partie is "she had left". Negation wraps the auxiliary, not the participle: je n'avais pas mangé.
The avoir/être choice
Most verbs take avoir. Être covers two groups: pronominal verbs, which keep their reflexive pronoun (je m'étais levé), and a closed set of movement and change-of-state verbs. Lingolia lists them as naître/mourir, aller/venir, monter/descendre, arriver/partir, entrer/sortir, apparaître, devenir, passer, rester, retourner and tomber, together with their compounds such as revenir, rentrer, remonter, redescendre and repartir.
Several of those verbs change auxiliary when they take a direct object, and the meaning shifts with it. Lingolia's example pair makes the difference visible: À quelle heure étais-tu sorti ce matin-là? has no direct object, so être is correct, while Avais-tu sorti les carottes du frigo hier soir? has les carottes as its direct object, so the verb takes avoir. Descendre, (r)entrer, (re)monter and retourner behave the same way.
The auxiliary itself is not new information at this point. The plus-que-parfait uses the same avoir and être split as the passé composé, and the same agreement rules apply to both tenses. What changes is only the tense the auxiliary is conjugated in, which moves from the present into the imparfait.
Agreement rules for the participle
With être, the participle agrees with the subject in gender and number: il était allé, elle était allée, ils étaient allés, elles étaient allées.
With avoir, the participle agrees only when a direct object precedes the verb. Lingolia's example is la lettre qu'elle avait écrite, where the direct object la lettre sits in front of avait écrit. With no preceding object there is no agreement: elle avait écrit la lettre.
The object standing in front can be a noun or a pronoun. Lingolia gives the noun case as la lettre qu'elle avait écrite, and notes that a personal pronoun such as me, te, le, la, nous or vous triggers the same agreement when it comes before the verb.
These are the agreement rules the passé composé already uses, since both tenses are built the same way from an auxiliary plus a participle.
Three situations that call for it
The first is plain anteriority: one past action happened before another. Le soleil avait déjà commencé à se coucher quand je suis arrivé ("The sun had already started to set when I arrived") puts the sunset behind the arrival.
The second is the hypothetical si-clause, where the plus-que-parfait states the condition and the conditionnel passé states the outcome: Si j'avais fini le travail, je serais parti tôt ("If I had finished the work, I would have left early"). There is no second past action to be earlier than here; the whole construction is counterfactual, and Lawless French notes this is where the tense appears without a following past event. The French conditional page works through the same si-clause pairing from the other side.
A third setting is indirect speech. When the reporting verb sits in the past, a passé composé in the original moves back one step. Lawless French gives the mapping: the present becomes the imparfait, the passé composé becomes the plus-que-parfait, and the future becomes the conditional. J'ai fini le travail reported after a past verb therefore comes back as il a dit qu'il avait fini le travail, with avoir shifted from the present into the imparfait.
The later event can also be compressed instead of stated. Avant de plus an infinitive, avant que plus the subjunctive, or avant plus a noun all do the job: J'avais fini tout le travail avant de partir ("I had finished all the work before leaving").
Where the three past tenses sit
Set beside the other two past tenses, the plus-que-parfait covers the layer furthest back. The imparfait is the tense of an incomplete or ongoing action or state of being, which Lawless French ties to description, habit and background. The passé composé presents a past event as a completed whole, and it is usually the later verb in a sentence that also contains a plus-que-parfait. The plus-que-parfait sits behind both, marking what was already done before the reference point arrived.
The practical test is order plus connection. If a reader needs to know that one thing was already done before the other happened, the plus-que-parfait is the tense. If the two events simply sit side by side in a narrative, or if the point is what was going on in the background, one of the other two past tenses is doing the work.
One sentence can separate all three. In Quand je suis arrivé à la fête, tout le monde était déjà parti, et la musique jouait encore, the arrival is the reference point and takes the passé composé, the guests' departure had already happened and takes the plus-que-parfait, and the music was still going in the background, which is the imparfait's job. Move the events around and the tenses follow the meaning rather than the sentence order.