Cause of apical periodontitis is/are:
Sequel of pulpal diseases
Wedging of foreign object between the teeth
High points in restoration
All of the above
Apical periodontitis (AP) may occur in a vital or nonvital tooth.
Causes of AP in a vital tooth:

Abnormal occlusal contacts
High points in restoration
Wedging of foreign object between the teeth
Traumatic blow to teeth (Eg: Concussion).

Causes of AP in a nonvital tooth:

Sequelae of pulpal diseases  
Iatrogenic
Apical extrusion of debris through apical foramen during RCT.
Pushing irrigants or medicaments or obturating material through apical foramen.