Laparoscopic surgery: Why did the gas cause pain in my shoulder, and how did it escape my body?
Does CO2 cause pain?

CO2 can cause pain by applying pressure on the diaphragm; also stretching of the diaphragm due to the body position can irritate the phrenic nerve (Indian Journal of Surgery).

ALSO:


  It was once believed the resultant shoulder pain was simply due to
  reaction of the gas combining with water; or that it was merely
  trapped CO2. The actual cause of this irritation is the result of
  cellular death caused by the combination of a temperature change from the gas at 70oF and the drying effect of the gas at
  .0002%. Much of this irritation is centered on the diaphragmatic
  region. Experiments with gases other than CO2 i.e. helium, nitrous
  oxide and argon have all produced the same or similar effect (Center
  for Endometriosis Care).


Why they use CO2?


  To begin, during Laparoscopy, CO2 (carbon dioxide) gas is injected
  through a special needle inserted just below your navel. This is done
  to create and maintain a distended abdomen; a condition called
  "pneumoperitoneum."  For safety, cost and convenience, CO2 is used
  almost exclusively for this purpose (Center for Endometriosis Care).


Why is pain in the right shoulder?


  The mechanism of laparoscopy-induced shoulder pain is mainly derived
  from carbon dioxide retention within the abdomen, subsequently
  irritating the phrenic nerve and causing referred pain in the C4
  dermatome. Moreover, carbon dioxide trapped between the liver and the
  right diaphragm, irritating the diaphragm, also causes upper abdominal pain (JAMA Surgery).


BUT


  In such hiatal surgeries including LAGB and in few gynecological
  surgeries, pain occurs preferentially on the left shoulder. This
  difference suggests that the region of surgery and position of the
  patient have an important influence on the site of pain. The cause is
  that in laparoscopic cholecystectomy the liver is separated from the
  undersurface of the diaphragm because of the reverse Trendelenburg
  with a right side up position of the patient. This leads to
  stretching of the right hemidiaphragm and the gas to be potentially trapped below the right diaphragm. Reverse is true for
  hiatal surgeries (Indian Journal of Surgery).


Where does CO2 go after surgery?

Most of the gas passively leaves the abdominal cavity through the surgical wounds immediately after the procedure. What happens with the rest:


  Carbon dioxide readily dissolves in water and forms carbonic acid.
  Carbonic acid is then absorbed into the intravascular space...(JAMA Surgery)


CO2 is not released through the mouth and is not a direct cause of burping. Burping may result from the pressure of gas applied on the stomach and intestine.