Anastomotic leaks happen when there is a failure in the surgical connection between two segments of the bowel, leading to the leakage of intestinal contents into the abdominal cavity. Factors contributing to this failure can include poor blood supply to the anastomosis, tension at the surgical site, infection, and technical errors during surgery.