  The geometric Langlands correspondence has been interpreted as the mirror
symmetry of the Hitchin fibrations for two dual reductive groups. This mirror
symmetry, in turn, reduces to T-duality on the generic Hitchin fibers, which
are smooth tori. In this paper we study what happens when the Hitchin fibers on
the B-model side develop orbifold singularities. These singularities correspond
to local systems with finite groups of automorphisms. In the classical
Langlands Program local systems of this type are called endoscopic. They play
an important role in the theory of automorphic representations, in particular,
in the stabilization of the trace formula. Our goal is to use the mirror
symmetry of the Hitchin fibrations to expose the special role played by these
local systems in the geometric theory. The study of the categories of A-branes
on the dual Hitchin fibers allows us to uncover some interesting phenomena
associated with the endoscopy in the geometric Langlands correspondence. We
then follow our predictions back to the classical theory of automorphic
functions. This enables us to test and confirm them. The geometry we use is
similar to that which is exploited in recent work by B.-C. Ngo, a fact which
could be significant for understanding the trace formula.

Algebraic Geometry;High Energy Physics - Theory;Quantum Algebra;Representation Theory