The Endoscopic Classification of Representations