1. You use the pluperfect subjunctive to describe actions in the past when one action takes place before another.
2. The oldest action is in the pluperfect subjunctive and the other action can be in preterite, imperfect or pluperfect.
Carlos se sorprendió de que su amigo hubiera comprado todos los materiales
Esperaba que hubieran ido a la fiesta con los niños
Yo había querido que mis hermanos hubieran venido a la casa de la abuela.
3. You also use it when the main verb is in conditional
¿Sería posible que Teresa hubiera terminado el informe?
4. It is also use with como si because is normally referring to something contrary to the truth
Estaba tan cansada como si hubiera corrido todo el día