A stool sample should be collected when a child exhibits symptoms such as persistent diarrhea, bloody stools, unexplained abdominal pain, or signs of malnutrition. It's also crucial during outbreaks of gastrointestinal illnesses in schools or daycare centers. In some cases, stool samples may be required to monitor the effectiveness of treatment for certain conditions.