The primary cause of PE is the formation of blood clots in the deep veins of the legs, which can travel to the lungs. Risk factors for developing these clots include prolonged immobility (such as long flights or bed rest), surgery, certain medical conditions (like cancer or heart disease), smoking, obesity, and the use of hormonal contraceptives or hormone replacement therapy.