Why are stool samples ordered?

I have an upcoming doctors appointment and I’m just curious as to why stool samples are ordered and what the necessarily look for ?