How does pooping work?
After your food is done digesting, the leftovers from the digestion system get delivered to the inner sphincter. The inner sphincter opens in a reflex and lets a little bit of content through, for testing. Sensory cells analyze whether the content is a solid or gas, and pass that information to the brain. The brain analyzes the data, your surroundings, decides what to do and communicates with your nervous system to get it done (or to hold it for later).