Diarrhea can be caused by several diseases. That is why it is hard to point just at one when it happens. Sometimes even specific foods or small changes at a dogs dietary lifestyle can cause, what we call acute diarrhea. In this case correcting the feeding errors will be enough to make it go away.
While in case of diarrhea caused by infectious agents such as viruses or bacteria it requires proper antibiotics. More complicated cases may require emergency treatment or even supportive therapy.
If the diarrhea is chronic, which means that has lasted for more than 3-4 weeks its causes might be by several factors like food allergies, parasites, problem with the intestines and their ability to absorb food, liver problems, pancreatic disease, tumors in GI. To find specifically the cause requires several tests and it is more difficult to treat.