Postoperative atrial fibrillation (POAF) is an ongoing complication following cardiac surgery, with an incidence of 15%–60%. It is associated with substantial mortality and morbidity, as well increased hospital stays and healthcare costs. The pathogenesis is not fully understood, but the literature suggests that POAF occurs when transient, postoperative triggers act on vulnerable atrial tissue produced by preoperative, procedure-induced and postoperative processes such as inflammation, oxidative stress, autonomic dysfunction and electrophysiological remodelling of the atrial tissues. This sets the stage for arrhythmogenic mechanisms, such as ectopic firing secondary to triggered activity and re-entry mechanisms generating POAF. Preoperative factors include advanced age, sex, ethnicity, cardiovascular risk factors, preoperative drugs, electrocardiogram and echocardiogram abnormalities. Procedural factors include: the use of cardiopulmonary bypass and aortic cross clamp, type of cardiac surgery, use of hypothermia, left ventricular venting, bicaval cannulation and exclusion of the left atrial appendage. Postoperative factors include postoperative drugs, electrolyte and fluid balance and infection. This review explores the pathogenesis of POAF and the contribution of these perioperative factors in the development of POAF. Patients can be risk stratified for targeted treatment and prophylaxis, and how these factors can be attenuated to improve POAF outcomes following cardiac surgery.