Why do an endoscopy?

Many reasons! Everyone should have a colonoscopy, which is one type of endoscopy, at age 50 (sooner if there is a family history suggesting higher risk for colon cancer). Other types of endoscopy can look at different parts of the body, such as the esophagus, stomach, bile ducts, vocal cords, airways, bladder and ureters. These procedures are done if symptoms or other tests suggest a need for evaluation.
To screen for cancer. If you are referring to a colonoscopy, which is a lower gastrointestinal endoscopy, then they might find polyps (precancerous growths) or colon cancer. On the other end, there are upper endoscopes (egds) which look at the esophagus and stomach and first part of the small intestine and there could be cancers found there too.