The fluid is collected via a procedure called paracentesis, which involves inserting a needle into the peritoneal cavity. In pediatric patients, this procedure is often performed under ultrasound guidance to minimize risks. It's essential to ensure that the child is stable and that the benefits of the procedure outweigh the risks.