There are some things that make ablution invalid; such as any discharge from private parts and this applies to stool, urine, semen, blood and wind. Also Deep sleep and touching one’s private parts break ablution.
More than one hadith clarify what should be done when going to the toilet. Entering with the left foot and leaving with the right one is recommended, as well as saying some prayers and other points discussed below.