More or less the same way as humans. Except it comes out of an opening called a Cloaca, which is kinda an all in one hole, for ****, piss and reproduction. Birds have this too.
It does kinda make sense when you think about it though, instead of having two different ways to remove waste, just have one "exit". I don't know much about animals but i would assume birds and snakes don't actually drink water but actually absorb it from what they eat.