  Let $X_{1}$ be a projective, smooth and geometrically connected curve over
$\mathbb{F}_{q}$ with $q=p^{n}$ elements where $p$ is a prime number, and let
$X$ be its base change to an algebraic closure of $\mathbb{F}_{q}$. We give a
formula for the number of irreducible $\ell$-adic local systems ($\ell\neq p$)
with a fixed rank over $X$ fixed by the Frobenius endomorphism. We prove that
this number behaves like a Lefschetz fixed point formula for a variety over
$\mathbb{F}_q$, which generalises a result of Drinfeld in rank $2$ and proves a
conjecture of Deligne. To do this, we pass to the automorphic side by Langlands
correspondence, then use Arthur's non-invariant trace formula and link this
number to the number of $\mathbb{F}_q$-points of the moduli space of stable
Higgs bundles.
