\section{{#1}}}

\newcommand{\uple}[1]{\text{\boldmath${#1}$}}

\def\stacksum#1#2{{\stackrel{{\scriptstyle #1}}
{{\scriptstyle #2}}}}

\def--{--}

\def\map#1#2#3#4{\begin{matrix}#1&\to &#2
\\#3 &\to &#4
\end{matrix}}
\newcommand{\uple{\alpha}}{\uple{\alpha}}
\newcommand{\uple{\beta}}{\uple{\beta}}
\newcommand{\uple{b}}{\uple{b}}
\newcommand{\uple{a}}{\uple{a}}
\newcommand{\uple{h}}{\uple{h}}
\newcommand{\uple{l}}{\uple{l}}
\newcommand{\bft}{\uple{t}}
\newcommand{\uple{x}}{\uple{x}}
\newcommand{\uple{y}}{\uple{y}}
\newcommand{\uple{m}}{\uple{m}}
\newcommand{\uple{n}}{\uple{n}}
\newcommand{C(\mathcal{F})}{C(\mathcal{F})}
\newcommand{\uple{I}}{\uple{I}}
\newcommand{\uple{J}}{\uple{J}}
\newcommand{\mathrm{e}_q}{\mathrm{e}_q}
\newcommand{\mathrm{Std}}{\mathrm{Std}}
\newcommand{\mathrm{Sym}}{\mathrm{Sym}}
\newcommand{\mathrm{sym}}{\mathrm{sym}}
\newcommand{\mathrm{arith}}{\mathrm{arith}}
\newcommand{\mathrm{Irr}}{\mathrm{Irr}}
\newcommand{\mathrm{geom}}{\mathrm{geom}}
\newcommand{G^{\mathrm{arith}}}{G^{\mathrm{arith}}}
\newcommand{G_n^{\mathrm{arith}}}{G_n^{\mathrm{arith}}}
\newcommand{G^{\mathrm{geom}}}{G^{\mathrm{geom}}}
\newcommand{G_{\mathcal{F},\mathrm{arith}}}{G_{\mathcal{F},\mathrm{arith}}}
\newcommand{G_{\mathcal{F},\mathrm{geom}}}{G_{\mathcal{F},\mathrm{geom}}}
\newcommand{\Garithd}[1]{G_{{#1},\mathrm{arith}}}
\newcommand{\Ggeomd}[1]{G_{{#1},\mathrm{geom}}}
\newcommand{K^{\mathrm{sep}}}{K^{\mathrm{sep}}}
\newcommand{K_x^{\mathrm{sep}}}{K_x^{\mathrm{sep}}}
\newcommand{\mathbf{0}}{\mathbf{0}}
\newcommand{\mathbf{R}}{\mathbf{R}}
\newcommand{\mathbf{S}}{\mathbf{S}}
\newcommand{\mathbf{F}}{\mathbf{F}}
\newcommand{\mathbf{K}}{\mathbf{K}}
\newcommand{\mathbf{M}}{\mathbf{M}}
\newcommand{\mathbf{N}}{\mathbf{N}}
\newcommand{\mathbf{C}}{\mathbf{C}}
\newcommand{\mathbf{S}}{\mathbf{S}}
\newcommand{\mathbf{C}^\times}{\mathbf{C}^\times}
\newcommand{\mathbf{N}}{\mathbf{N}}
\newcommand{\mathbf{A}}{\mathbf{A}}
\newcommand{\mathbf{G}_{m}}{\mathbf{G}_{m}}
\newcommand{\mathbf{G}_{m,{\mathbf{F}_q}}}{\mathbf{G}_{m,{\mathbf{F}_q}}}
\newcommand{\mathbf{B}}{\mathbf{B}}
\newcommand{\mathbf{D}}{\mathbf{D}}
\newcommand{\mathbf{Z}}{\mathbf{Z}}
\newcommand{\mathbf{P}}{\mathbf{P}}
\newcommand{\mathbf{R}}{\mathbf{R}}
\newcommand{\mathbf{G}}{\mathbf{G}}
\newcommand{q^{1/2}}{q^{1/2}}
\newcommand{q^{-1/2}}{q^{-1/2}}

\newcommand{\mathbf{H}}{\mathbf{H}}
\newcommand{\mathbf{Q}}{\mathbf{Q}}
\newcommand{\mathbf{Q}_{\ell}}{\mathbf{Q}_{\ell}}
\newcommand{\ov{\mathbf{Q}_{\ell}}}{\ov{\mathbf{Q}_{\ell}}}
\newcommand{\ov{{\mathbf{F}_q}}}{\ov{{\mathbf{F}_q}}}
\newcommand{{\mathbf{F}_p}}{{\mathbf{F}_p}}
\newcommand{{\mathbf{F}^\times_p}}{{\mathbf{F}^\times_p}}
\newcommand{{\mathbf{F}_q}}{{\mathbf{F}_q}}
\newcommand{{\mathbf{F}_{q^n}}}{{\mathbf{F}_{q^n}}}
\newcommand{{\mathbf{F}^\times_{q^n}}}{{\mathbf{F}^\times_{q^n}}}
\newcommand{{\mathbf{F}^\times_q}}{{\mathbf{F}^\times_q}}
\newcommand{{\mathbf{F}_{q^d}}}{{\mathbf{F}_{q^d}}}
\newcommand{{\mathbf{F}^\times_{q^d}}}{{\mathbf{F}^\times_{q^d}}}
\newcommand{\mathbf{F}}{\mathbf{F}}
\newcommand{\bar{\Ff}_p}{\bar{\mathbf{F}}_p}
\newcommand{\bar{\Ff}_q}{\bar{\mathbf{F}}_q}
\newcommand{\bar{\Qq}_{\ell}}{\bar{\mathbf{Q}}_{\ell}}
\newcommand{\mathbf{T}}{\mathbf{T}}
\newcommand{\mathbf{G}}{\mathbf{G}}
\newcommand{g^\natural}{g^\natural}
\newcommand{\boldsymbol{\mu}}{\boldsymbol{\mu}}
\newcommand{\mathcal{O}}{\mathcal{O}}
\newcommand{\mathcal{V}}{\mathcal{V}}
\newcommand{\mathcal{O}}{\mathcal{O}}
\newcommand{\mathcal{N}}{\mathcal{N}}
\newcommand{\mathcal{H}}{\mathcal{H}}
\newcommand{\mathcal{K}\ell}{\mathcal{K}\ell}
\newcommand{\mathcal{K}\ell}{\mathcal{K}\ell}

\newcommand{\overline{\mathbf{F}}}{\overline{\mathbf{F}}}
\newcommand{\mathcal{E}}{\mathcal{E}}
\newcommand{\mathcal{H}}{\mathcal{H}}
\newcommand{\mathcal{C}}{\mathcal{C}}
\newcommand{\mathcal{L}}{\mathcal{L}}
\newcommand{\text{\boldmath$P$}}{\mathbf{P}}
\newcommand{\text{\boldmath$E$}}{\mathbf{E}}
\newcommand{\mathbf{V}}{\mathbf{V}}
\newcommand{\mathbf{1}}{\mathbf{1}}
\newcommand{\mathcal{B}}{\mathcal{B}}
\newcommand{g^{\sharp}}{g^{\sharp}}
\newcommand{y^{\sharp}}{y^{\sharp}}
\newcommand{\clconj}[1]{{{#1}}^{\sharp}}

\newcommand{\mods}[1]{\,(\mathrm{mod}\,{#1})}

\newcommand{\sli}[1]{\underline{{#1}}}

\newcommand{\ideal}[1]{\mathfrak{{#1}}}

\newcommand{\mathrm{Id}}{\mathrm{Id}}

\newcommand{\widehat}{\widehat}
\newcommand{\mathcal{C}}{\mathcal{C}}
\newcommand{\mathbf{G}}{\mathbf{G}}
\newcommand{\mathbf{B}}{\mathbf{B}}
\newcommand{\mathbf{D}}{\mathbf{D}}
\newcommand{\mathbf{G}^{opt}}{\mathbf{G}^{opt}}
\newcommand{\hautk}[2]{\mathbf{G}_{{#1},{#2}}}
\newcommand{\hautz}[2]{\mathbf{G}^{a}_{{#1},{#2}}}
\newcommand{\hauti}[3]{\mathbf{G}^{{#1}}_{{#2},{#3}}}

\DeclareMathOperator{\frob}{Fr}

\newcommand{\mathcal{S}}{\mathcal{S}}
\newcommand{\skl}[1]{\sheaf{K}^{({#1})}}
\newcommand{\hk}[1]{\sheaf{K}\ell_{{#1}}}
\newcommand{\mutw}[3]{\mu_{{#3},{#2}}}
\newcommand{\frtr}[3]{(\Tr{{#1}})({#2},{#3})}
\DeclareMathOperator{\hypk}{Kl}

\newcommand{\mathcal{M}}{\mathcal{M}}

\newcommand{\rightarrow}{\rightarrow}
\newcommand{\longrightarrow}{\longrightarrow}
\newcommand{\twoheadrightarrow}{\twoheadrightarrow}
\newcommand{\hookrightarrow}{\hookrightarrow}
\newcommand{\hookleftarrow}{\hookleftarrow}
\newcommand{\Longleftrightarrow}{\Longleftrightarrow}
\newcommand{\fleche}[1]{\stackrel{#1}{\longrightarrow}}
\newcommand{\flecheinj}[1]{\stackrel{#1}{\hookrightarrow}}
\newcommand{\flechecinj}[1]{\stackrel{#1}{\hookleftarrow}}

\newcommand{\barre}[1]{\overline{{#1}}}

\DeclareMathOperator{\Spec}{Spec}
\DeclareMathOperator{\Vol}{Vol}
\DeclareMathOperator{\proj}{Proj}
\DeclareMathOperator{\Card}{Card}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\rk}{rk}
\DeclareMathOperator{\res}{Res}
\DeclareMathOperator{\reg}{reg}
\DeclareMathOperator{\ord}{ord}
\DeclareMathOperator{\cl}{Cl}
\DeclareMathOperator{\Div}{Div}
\DeclareMathOperator{\divg}{divg}
\DeclareMathOperator{\Pic}{Pic}
\DeclareMathOperator{\vol}{Vol}
\DeclareMathOperator{\Imag}{Im}
\DeclareMathOperator{\Reel}{Re}
\DeclareMathOperator{\syms}{Sym^{2}}
\DeclareMathOperator{\symk}{Sym}
\DeclareMathOperator{\li}{li}
\DeclareMathOperator{\Frob}{\mathrm{Frob}}
\DeclareMathOperator{\Fr}{\mathrm{Frob}}
\DeclareMathOperator{\Kl}{\mathrm{Kl}}
\DeclareMathOperator{\shKl}{\mathrm{Kl}}
\DeclareMathOperator{\ET}{\mathrm{ET}}
\DeclareMathOperator{\tr}{\mathrm{tr}}
\DeclareMathOperator{\nr}{\mathrm{Nr}}
\DeclareMathOperator{\Gal}{Gal}
\DeclareMathOperator{\Ind}{Ind}
\DeclareMathOperator{\Res}{Res}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\im}{Im}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\Hom}{Hom}
\DeclareMathOperator{\End}{End}
\DeclareMathOperator{\Aut}{Aut}
\DeclareMathOperator{\varia}{Var}
\DeclareMathOperator{\argu}{Arg}
\DeclareMathOperator{\spect}{Spec}
\DeclareMathOperator{\disc}{disc}
\DeclareMathOperator{\swan}{Swan}
\DeclareMathOperator{\Sing}{Sing}
\DeclareMathOperator{\Drop}{drop}
\DeclareMathOperator{\sw}{Swan}
\DeclareMathOperator{\bb}{B}
\DeclareMathOperator{\codim}{codim}
\DeclareMathOperator{\ft}{FT}
\DeclareMathOperator{\cond}{\mathbf{c}}
\DeclareMathOperator{\Ad}{Ad}
\DeclareMathOperator{\dual}{D}
\DeclareMathOperator{\nearb}{R\Psi}
\DeclareMathOperator{\van}{R\Phi}
\DeclareMathOperator{\class}{c\ell}

\newcommand{\varepsilon}{\varepsilon}
\renewcommand{\rho}{\varrho}

\DeclareMathOperator{\SL}{SL}

\DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\PGL}{PGL}
\DeclareMathOperator{\PGLd}{PGL_2}
\DeclareMathOperator{\rmT}{T}
\DeclareMathOperator{\rmB}{B}
\DeclareMathOperator{\rmG}{G}
\DeclareMathOperator{\rmN}{N}
\DeclareMathOperator{\rmU}{U}
\DeclareMathOperator{\PSL}{PSL}
\DeclareMathOperator{\Sp}{Sp}
\DeclareMathOperator{\GSp}{GSp}
\DeclareMathOperator{\SO}{SO}
\DeclareMathOperator{\Ort}{O}
\DeclareMathOperator{\SU}{SU}
\DeclareMathOperator{\Un}{U}
\DeclareMathOperator{\USp}{USp}

\newcommand{{\textstyle{\frac{1}{2}}}}{{\textstyle{\frac{1}{2}}}}
\newcommand{{\textstyle{\frac{1}{4}}}}{{\textstyle{\frac{1}{4}}}}
\newcommand{{\textstyle{\frac{3}{2}}}}{{\textstyle{\frac{3}{2}}}}

\newcommand{\avg}[1]{A[{#1}]}
\newcommand{\underline{O}}{\underline{O}}
\newcommand{O}{O}

\newcommand{\sheaf}[1]{\mathcal{{#1}}}
\newcommand{M}{M}
\newcommand{linearly disjoint}{linearly disjoint}
\newcommand{\sheafm}[1]{\tilde{\sheaf{{#1}}}_{\ell}}

\DeclareMathSymbol{\gena}{\mathord}{letters}{"3C}
\DeclareMathSymbol{\genb}{\mathord}{letters}{"3E}

\def\mathop{\sum \Bigl.^{\flat}}\limits{\mathop{\sum \Bigl.^{\flat}}\limits}
\def\mathop{\sum \Bigl.^{+}}\limits{\mathop{\sum \Bigl.^{+}}\limits}
\def\mathop{\sum \sum}\limits{\mathop{\sum \sum}\limits}
\def\mathop{\sum \sum \sum \sum}\limits{\mathop{\sum \sum \sum \sum}\limits}
\def\mathop{\sum\ldots \sum}\limits{\mathop{\sum\ldots \sum}\limits}
\def\mathop{\sum\bigl.^{\flat}}\limits{\mathop{\sum\bigl.^{\flat}}\limits}
\def\mathop{\sum \Bigl.^{*}}\limits{\mathop{\sum \Bigl.^{*}}\limits}
\def\mathop{\sum\sum \Bigl.^{*}}\limits{\mathop{\sum\sum \Bigl.^{*}}\limits}
\def\mathop{\sum\sum \Bigl.^{\sharp}}\limits{\mathop{\sum\sum \Bigl.^{**}}\limits}
\def\mathop{\sum\sum \Bigl.^{\sharp}}\limits{\mathop{\sum\sum \Bigl.^{\sharp}}\limits}
\def\mathop{\prod \Bigl.^{*}}\limits{\mathop{\prod \Bigl.^{*}}\limits}
\def\mathop{\sum \Bigl.^{h}}\limits{\mathop{\sum \Bigl.^{h}}\limits}
\def\frac{1}{2i\pi}\mathop{\int}\limits{\frac{1}{2i\pi}\mathop{\int}\limits}
\def\mathop{\oplus}\limits{\mathop{\oplus}\limits}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{conjecture}[theorem]{Conjecture}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{xca}[theorem]{Exercise}

\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}

\numberwithin{equation}{section}

\newcommand{\mathcal{M}}{\mathcal{M}}
\newcommand{\mathcal{L}}{\mathcal{L}}
\newcommand{\mathcal{S}}{\mathcal{S}}
\newcommand{\mathcal{C}}{\mathcal{C}}
\newcommand{\mathcal{P}}{\mathcal{P}}
\newcommand{\mathcal{F}}{\mathcal{F}}
\newcommand{\mathcal{Q}}{\mathcal{Q}}
\newcommand{\mathcal{K}}{\mathcal{K}}
\newcommand{\mathcal{R}}{\mathcal{R}}
\newcommand{\mathcal{J}}{\mathcal{J}}
\newcommand{\mathcal{I}}{\mathcal{I}}
\newcommand{\mathcal{G}}{\mathcal{G}}
\newcommand{\mathcal{B}}{\mathcal{B}}
\newcommand{\mathcal{E}}{\mathcal{E}}

\newcommand{\mathfrak{a}}{\mathfrak{a}}
\newcommand{\mathfrak{p}}{\mathfrak{p}}

\newcommand{\lambda_f}{\lambda_f}
\newcommand{\rho_f}{\rho_f}
\newcommand{\lambda_g}{\lambda_g}
\newcommand{\rho_g}{\rho_g}

\newcommand{\varphi}{\varphi}

\renewcommand{\geq}{\geqslant}
\renewcommand{\leq}{\leqslant}
\renewcommand{\Re}{\mathfrak{Re}\,}
\renewcommand{\Im}{\mathfrak{Im}\,}

\newcommand{\eqref}{\eqref}
\newcommand{\backslash}{\backslash}

\newcommand{\ov}[1]{\overline{#1}}

\newcommand{\peter}[1]{\langle{#1}\rangle}
\newcommand\sumsum{\mathop{\sum\sum}\limits}
\newcommand\sumsumsum{\mathop{\sum\sum\sum}\limits}
\newcommand\sumsumnd{\mathop{{\sum\sum}^{nd}}\limits}
\newcommand\delval{1/8}
\newcommand\delvaln{1/16}
\newcommand\finalexponent{1/24}
\newcommand\rpfree{1/144}

\begin{document}

\title[]{Lectures on Applied $\ell$-adic Cohomology}

\author{\'Etienne Fouvry}
\address{Laboratoire de Math\'ematiques d'Orsay, Universit\'e Paris-Sud,
  CNRS, Universit\'e Paris-Saclay, \linebreak[4]  91405 Orsay, France}
\email{etienne.fouvry@u-psud.fr}

\author{Emmanuel Kowalski}
\address{ETH Z\"urich -- D-MATH\\
  R\"amistrasse 101\\
  CH-8092 Z\"urich\\
  Switzerland} \email{kowalski@math.ethz.ch}

\author{Philippe Michel} \address{EPFL/SB/TAN, Station 8, CH-1015
  Lausanne, Switzerland } \email{philippe.michel@epfl.ch}

\author{Will Sawin }\address{Mathematics Department,
Rm 411, MC 4439 2990 Broadway
New York NY 10027, Columbia University, USA }
\email{will.sawin@columbia.edu}

\subjclass[2000]{Primary }

\date{\today}

\begin{abstract} We describe how a systematic use of the deep methods from $\ell$-adic cohomology pioneered by Grothendieck and Deligne and further developed by Katz and Laumon help make progress on various classical questions from analytic number theory. This text is an extended version of a series of lectures given during the 2016 Arizona Winter School.
 \end{abstract}

\maketitle

\setcounter{tocdepth}{1}
\tableofcontents

\tableofcontents

\section{Introduction}
One of the most basic question in number theory is to understand how various  sets of integers behave when restricted to (i.e.~intersected with) {\em congruence classes}, a notion that goes back at least to Euclid and was exposed systematically by Gauss in his 1801 {\em Disquisitiones Arithmeticae} (following works of Fermat, Euler, Wilson, Lagrange, Legendre and their predecessors from the middle ages and antiquity), and which is fundamental to number theory.

Let us recall that given an integer $q\in\mathbf{Z}-\{0\}$, a {\em congruence class} (a.k.a. an {\em arithmetic progression}) modulo  $q$ is a subset of $\mathbf{Z}$ of the shape
$$a\mods q=a+q\mathbf{Z}\subset \mathbf{Z}$$
for some integer $a$. The set of congruence classes modulo $q$ is denoted $\mathbf{Z}/q\mathbf{Z}$; it is a finite ring of cardinality $q$ (with addition  and multiplication induced by that of $\mathbf{Z}$).

In number theory, especially analytic number theory, one is interested in studying the behaviour of some given arithmetic function along congruence classes, for instance to determine whether a set of integers has finite or infinite intersection with some congruence class. The analysis of such  problem, which may involve quite sophisticated manipulations, often involves certain specific classes of functions on $\mathbf{Z}/q\mathbf{Z}$.

When studying such functions, it is natural to invoke the
 {\em Chinese Remainder Theorem}
$$\mathbf{Z}/q\mathbf{Z}\simeq \prod_{p^\alpha\|q}\mathbf{Z}/p^\alpha\mathbf{Z}$$
which largely  reduces the study to the case of prime power moduli; then, in many instances, the deepest case is when $q$ is a prime; the ring $\mathbf{Z}/q\mathbf{Z}$ is then a finite field, denoted ${\mathbf{F}_q}$, and often the functions that occur are what we will call {\em trace functions.}

The objective of these lectures is utilitarian: our aim is to describe these trace functions, many examples, their theory and most importantly how they are handled when they occur in analytic number theory. Indeed the mention of "\'etale" or "$\ell$-adic cohomology", "sheaves", "purity", "functors", "local systems" or "vanishing cycles" sounds  forbidding to the working analytic number theorist and often prevents him/her to embrace the subject and make full use of the powerful methods that Deligne, Katz, Laumon have developed for us. It is our hope that after these introductory lectures, any of the remaining readers will feel ready for and at ease with more serious activities such as the reading of the wonderful series of orange books by Katz, and eventually will be able to tackle by him/herself any trace function that nature has laid in front of him/her.

\subsection*{Acknowledgements} These expository notes are an expanded version of a series of lectures given by Ph.M. and W.S. during the 2016 Arizona Winter School and based on our recent joint works.

We would like to thank the audience for its attention and its numerous questions during the daily lectures, as well as the teams of student, who  engaged in the research activities that we proposed during the evening sessions, for their enthusiasm. Big thanks are also due to Alina Bucur, Bryden Cais and David Zureick-Brown for the perfect organization, making this edition of the AWS a memorable experience. We would also like to thank the referees for correcting many mistakes and typosin earlier versions of this text.

\section{Examples of trace functions}

Unless stated otherwise, we now assume that $q$ is a prime number.

\subsection{Characters}
{\em Trace functions modulo $q$} are special classes of $\mathbf{C}$-valued functions on ${\mathbf{F}_q}$ of geometric origin. Perhaps the first significant example, beyond the constant function $1$, is the {\em Legendre symbol} (for $q\geq 3$)
$$\left(\frac{\cdot}q\right): x\in{\mathbf{F}_q}\to \begin{cases}0& \hbox{ if $x=0$}\\
+1&\hbox{ if $x\in({\mathbf{F}^\times_q})^2$}\\
 	-1&\hbox{ if $x\in{\mathbf{F}^\times_q}-({\mathbf{F}^\times_q})^2$}
 \end{cases}
$$
which detects the squares modulo $q$, and whose arithmetic properties (especially the {\em quadratic reciprocity law}) were studied by Gauss in the {\em Disquisitiones}.

The class of trace functions was further enriched by P. G. Dirichlet: on his way to  proving his famous theorem on primes in arithmetic progressions, he introduced what are  now called {\em Dirichlet characters}, i.e.~the homomorphisms of the multiplicative group
$$\chi: (\mathbf{Z}/q\mathbf{Z})^\times\to \mathbf{C}^\times$$
(with $\chi(0)$ defined to be $0$ for $\chi$ non-trivial).

Another significant class of trace functions are the additive characters
$$\psi:(\mathbf{Z}/q\mathbf{Z},+)\to \mathbf{C}^\times.$$
These are all of the shape
$$x\in\mathbf{Z}/q\mathbf{Z}\mapsto \mathrm{e}_q(ax):=\exp\left(2\pi i\frac{\tilde a\tilde x}q\right)$$
(say) for some $a\in\mathbf{Z}/q\mathbf{Z}$, where $\tilde a$ and $\tilde x$ denote elements (lifts) of the congruence classes $a\mods q$ and $x\mods q$. Both additive and multiplicative  characters satisfy the important {\em orthogonality relations}
$$\frac{1}{q}\sum_{x\in{\mathbf{F}_q}}\psi(x)\ov{\psi'(x)}=\delta_{\psi=\psi'},\ \frac{1}{q-1}\sum_{x\in{\mathbf{F}^\times_q}}\chi(x)\ov{\chi'(x)}=\delta_{\chi= \chi'};$$
and we will see later a generalization of these relations to arbitrary trace functions.

Additive and multiplicative characters can be combined together (by means of a Fourier transform) to form the (normalized) {\em Gauss sums}
$$\varepsilon_\chi(a)=\frac{1}{q^{1/2}}\sum_{x\in{\mathbf{F}^\times_q}}\chi(x)\mathrm{e}_q(ax),$$
but these are not really new functions of $a$: by a simple change of variable, one has
$$\varepsilon_\chi(a)=\ov{\chi}(a)\varepsilon_\chi(1)$$
for $a\in{\mathbf{F}^\times_q}$. For $\chi$ non-trivial,  Gauss proved that
$$|\varepsilon_\chi(1)|=1.$$

\subsection{Algebraic exponential sums}
Another important source of trace functions comes from the study of the diophantine equations
\begin{equation}\label{eqdiophantine}
Q(\uple{x})=0,\ \uple{x}=(x_1,\ldots,x_n)\in\mathbf{Z}^n,\ Q(X_1,\ldots,X_n)\in\mathbf{Z}[X_1,\ldots,X_n].
\end{equation}

For instance, the analysis of the {\em major arcs} in the  {\em circle method} of Hardy--Littlewood (cf.~\cite[Chap. 4]{Vaughan}) leads to the following algebraic exponential sums on $(\mathbf{Z}/q\mathbf{Z})^n$ obtained by Fourier transform
$$(a,\uple{x})\in (\mathbf{Z}/q\mathbf{Z})^{n+1}\mapsto \frac{1}{q^{n/2}}\sum_{\uple{y}\in(\mathbf{Z}/q\mathbf{Z})^n}\mathrm{e}_q(aQ(\uple{y})+\uple{x}.\uple{y}).$$
In the 1926's, while studying the case of a positive definite homogeneous polynomial $Q$ of degree $2$ in four variables (a positive definite integral quaternary quadratic form),  and introducing  a new  variant of the circle method, Kloosterman \cite{Kloost},  defined the so-called (normalized) {\em Kloosterman sums}
$$\Kl_2(a;q)=\frac{1}{q^{1/2}}\sum_\stacksum{x,y\in{\mathbf{F}^\times_q}}{xy=a}\mathrm{e}_q(x+y).$$
This is another example of a trace function, and indeed one that is defined via  Fourier transform.

By  computing their fourth moment  (see \cite[(4.26)]{IwTopics}), Kloosterman was able to obtain the first non-trivial bound for Kloosterman sums, namely
$$|\Kl_2(a;q)|\leq 2q^{1/4}.$$ This estimate proved crucial for the study of equation \eqref{eqdiophantine} in the case of quaternary positive definite quadratic forms. In the 1940's, this bound was improved  by A. Weil, who as a consequence of his proof of the Riemann hypothesis for curves over finite fields  proved the best individual upper bound (see \cite[\S 11.7]{IwKo}):
$$|\Kl_2(a;q)|\leq 2.$$

 In 1939, Kloosterman sums appeared again in the work of Petersson who related them to Fourier coefficients of modular forms.\footnote{In fact, Poincar\'e had already written them down in one of his last papers, published posthumously.} Since then, via the works of Selberg, Kuznetsov, Deshouillers-Iwaniec and many others, Kloosterman sums play a fundamental role in the analytic theory of automorphic forms\footnote{The double occurence of Kloosterman sums in the context of quadratic forms and of modular forms is explained by the theta correspondence}.

 A further important example of trace functions are the (normalized) {\em hyper-Kloosterman sums}. These are higher dimensional generalisations of Kloosterman sums, and are given, for any integer $k\geq 1$ by
 $$\Kl_k(a;q)=\frac{1}{q^{(k-1)/2}}\sum_\stacksum{x_1,\ldots, x_{k}\in{\mathbf{F}^\times_q}}{x_1.x_2.\ldots.x_k=a}\mathrm{e}_q(x_1+x_2+\ldots +x_k).$$
Hyper-Kloosterman sums were introduced by P. Deligne, who also established the following generalization of the Weil bound:
 $$|\Kl_k(a;q)|\leq k.$$

Hyper-Kloosterman sums can be interpreted as inverse (discrete)  Mellin transforms of powers of Gauss sums, and therefore can be used to study the distribution of Gauss sums. As was denoted by Katz in \cite{Sommes}, this fact and Deligne's bound imply the following\footnote{See \cite{KatzConvol} for a considerable generalisation of this theorem.}
 \begin{theorem} As $q\rightarrow\infty$, the set of (normalized)  Gauss sums
 $$\{\varepsilon_\chi(1),\ \chi\mods q\hbox{ non trivial }\}$$
 become equidistributed on the unit circle  $\mathbf{S}^1\subset \mathbf{C}^\times$ with respect to the uniform (Haar) probability measure.
 \end{theorem}
Hyper-Kloosterman sums also occur in the theory of automorphic forms; for instance, Luo, Rudnick and Sarnak used the fact that powers of Gauss sums occur in the root number of the functional equation of certain automorphic $L$-functions, the inverse Mellin transform property and Deligne's bound, to obtain non-trivial estimates for the Langlands parameters of automorphic representations on $\GL_n$ (giving in particular the first improvement of Selberg's famous $3/16$ bound for the Laplace eigenvalues of Maass cusp forms).

In addition, just as for the classical Kloosterman sums, hyper-Kloosterman sums also occur in the spectral theory of $\GL_k$ automorphic forms.

There are many more examples of trace functions, and we will describe some below along with ways to construct new trace functions from older ones.

\section{Trace functions and Galois representations}

Let $\mathbf{P}^1_{{\mathbf{F}_q}}$ be the projective line and $\mathbf{A}^1_{{\mathbf{F}_q}}\subset \mathbf{P}^1_{{\mathbf{F}_q}}$ be the affine line and $K={\mathbf{F}_q}(X)$ be the field of functions of $\mathbf{P}^1_{{\mathbf{F}_q}}$.

In the sequel we fix some prime $\ell\not=q$, $\ov{\mathbf{Q}_{\ell}}$ an algebraic closure of the field of $\ell$-adic numbers $\mathbf{Q}_{\ell}$ and an embedding $\iota\colon\ov{\mathbf{Q}_{\ell}}\hookrightarrow \mathbf{C}$  into the complex numbers. Trace functions modulo $q$ are $\ov\mathbf{Q}_{\ell}$-valued functions\footnote{Hence $\mathbf{C}$-valued via the fixed embedding $\iota$} defined on the set of ${\mathbf{F}_q}$-points of the affine line $\mathbf{A}^1({\mathbf{F}_q})\simeq {\mathbf{F}_q}$. They are obtained from {\em constructible} $\ell$-adic sheaves (often denoted $\mathcal{F}$) for the \'etale topology on $\mathbf{P}^1_{{\mathbf{F}_q}}$. All these notions are quite forbidding at first; fortunately the category of {\em constructible} $\ell$-adic sheaves on $\mathbf{P}^1_{{\mathbf{F}_q}}$ can be rather conveniently described in terms of the category of representations of the Galois group of $K$. Following \cite{Sommes,GKM}, we will start from this viewpoint.

 Let $K^{\mathrm{sep}}\supset K$ be a separable closure of $K$,  and $\ov\eta$ the associated geometric generic point (i.e.~$\Spec(K^{\mathrm{sep}})=\ov\eta$). Let $\ov{\mathbf{F}_q}\subset K^{\mathrm{sep}}$ denote the separable (or algebraic) closure of ${\mathbf{F}_q}$ in $K^{\mathrm{sep}}$. We denote
$$G^{\mathrm{geom}}:=\Gal(K^{\mathrm{sep}}/\ov{\mathbf{F}_q}.K)\subset G^{\mathrm{arith}}=\Gal(K^{\mathrm{sep}}/K), $$
the {\em geometric}, resp.~{\em arithmetic}, Galois group. By restricting the action of an element of $G^{\mathrm{arith}}$ to $\ov{\mathbf{F}_q}$ we have the exact sequence
\begin{equation}
1\rightarrow G^{\mathrm{geom}}\rightarrow G^{\mathrm{arith}}\rightarrow \Gal(\ov{\mathbf{F}_q}/{\mathbf{F}_q})\rightarrow 1.\label{exactgalois}
\end{equation}

\begin{definition} Let $U\subset \mathbf{A}^1_{\mathbf{F}_q}$ be a non-empty open subset of $\mathbf{A}^1_{\mathbf{F}_q}$ that is defined over ${\mathbf{F}_q}$. An $\ell$-adic sheaf lisse on $U$, say $\mathcal{F}$, is a continuous finite-dimensional Galois representation
$$\rho_\mathcal{F}:G^{\mathrm{arith}}\to \GL(V_\mathcal{F})$$
where $V_\mathcal{F}$ is a finite dimensional $\ov{\mathbf{Q}_{\ell}}$-vector space, which is unramified at every closed point $x$ of $U$.
The dimension $\dim V_\mathcal{F}$ is called the rank of $\mathcal{F}$ and is denoted $\rk(\mathcal{F})$. The vector space $V_{\mathcal{F}}$ is also denoted $\mathcal{F}_{\ov\eta}$.
\end{definition}

\subsection{Closed points on the affine line}

In this section we spell-out the meaning of the sentence "unramified at every closed point $x$ of $U$".

Let us recall that the datum of closed point of $\mathbf{P}^1_{{\mathbf{F}_q}}$ is equivalent to the datum of an embedding $\mathcal{O}_x\hookrightarrow K$ of a local ring\footnote{A PID with a unique prime ideal \cite[Chap. 1]{Serre}} $\mathcal{O}_x$ (the ring of rational functions defined in a neighborhood of $x$) whose field of fractions is $K$. Given such an embedding, we denote by $\mathfrak{p}_x$ its unique prime ideal, $\pi_x$ a generator of $\pi_x$ (an uniformizer) and by $v_x:K\rightarrow\mathbf{Z}\cup\{\infty\}$ the associated discrete valuation (normalized so that $v_x(\pi_x)=1$): we have
$$\mathcal{O}_x=\{f\in K,\ v_x(f)\geq 0\}\supset \mathfrak{p}_x=\{f\in K,\ v_x(f)> 0\}.$$
We denote by $k_x=\mathcal{O}_x/\mathfrak{p}_x$ its residue field and by $q_x=|k_x|=:q^{\deg x}$ the size of $k_x$ and $\deg x$ its degree

 The set of closed points of the projective line $\mathbf{P}^1_{{\mathbf{F}_q}}$ is the union of the set of closed points of the affine line $\mathbf{A}^1_{{\mathbf{F}_q}}$ which is indexed by the set of monic, irreducible (non-constant) polynomials of ${\mathbf{F}_q}[X]$
and the point $\infty.$
\begin{itemize}
\item For $\pi$ irreducible, monic and not constant, the local ring $\mathcal{O}_\pi$ is the localization of ${\mathbf{F}_q}[X]$ at the prime ideal $(\pi) \subseteq {\mathbf{F}_q}[X]$:
$$\mathcal{O}_\pi=\{P/Q,\ P,Q\in{\mathbf{F}_p}[X],\ \pi\!\!\not|Q\}\supset \mathfrak{p}_\pi=\{P/Q,\ P,Q\in{\mathbf{F}_p}[X],\ \pi|P,\ \pi\!\!\not|Q\},$$
the valuation $v_\pi$ is the usual valuation: for any  polynomial $P\in {\mathbf{F}_q}[X]$, $v_x(P)=v_\pi(P)$ is the exponent of the highest power of $\pi$ dividing $P$ which is extended to $K$ by setting $v_x(P/Q)=v_\pi(P)-v_\pi(Q)$, and the degree is $\deg \pi$.
\item For $\infty$,
$$\mathcal{O}_\infty=\{P/Q,\ P,Q\in{\mathbf{F}_p}[X],\ \deg P\leq\deg Q\}\supset \mathfrak{p}_\infty=\{P/Q,\ P,Q\in{\mathbf{F}_p}[X],\ \deg P<\deg Q\},$$
the valuation is minus the degree of the rational fraction
 $v_\infty(P/Q)=\deg(Q)- \deg(P),$ and the degree of $\infty$ is $1$.
\end{itemize}

\begin{remark}\label{closedpointsident}
We denote by $\mathbf{P}^1({\mathbf{F}_q})$ the set of closed points of degree $1$ and by $\mathbf{A}^1({\mathbf{F}_q})=\mathbf{P}^1({\mathbf{F}_q})-\{\infty\}$. Note that $\mathbf{A}^1({\mathbf{F}_q})$ is identified with ${\mathbf{F}_q}$ by identifying $x\in{\mathbf{F}_q}$ with the degree $1$ (irreducible) polynomial $X-x$.

Similarly a non-empty open set $U\subset \mathbf{A}^1_{{\mathbf{F}_q}}$ is the open complement of the closed set $Z_Q\subset \mathbf{A}^1_{{\mathbf{F}_q}}$ of zeros of some (non-zero) polynomial $Q\in{\mathbf{F}_q}[X]$, i.e.~defined by the equation $Q(x)=0$.

The "closed points of $U$" are the closed point associated with the irreducible monic  polynomials $\pi\in{\mathbf{F}_q}[X]$ coprime to $Q$ and the set of closed points of degree $1$, is identified with the complement of the set of roots of $Q$ contained in ${\mathbf{F}_q}$:
$$U({\mathbf{F}_q})\simeq \{x\in{\mathbf{F}_q},\ Q(x)\not=0\}\subset{\mathbf{F}_q}.$$
\end{remark}

\subsubsection{Decomposition group, inertia and Frobenius}
 The valuation $v_x$ can be extended (in multiple ways) to a ($\mathbf{Q}$-valued) valuation on $K^{\mathrm{sep}}$ and the choice of one such extension (denoted $v_{\{x\}}$) determines a decomposition and an inertia subgroup in the arithmetic Galois group
 $$I_{\{x\}}\subset D_{\{x\}}\subset G^{\mathrm{arith}}$$ fitting in the exact sequence
\begin{equation}\label{eqlocalgal}
1\rightarrow I_{\{x\}}\rightarrow D_{\{x\}}\rightarrow \Gal(\ov{\mathbf{F}_q}/k_x)\rightarrow 1.
\end{equation}
Let also us recall that $\Gal(\ov{\mathbf{F}_q}/k_x)$ is topologically generated by the {\em arithmetic Frobenius}
$$\Frob^{\mathrm{arith}}_{k_x}\colon\map{\ov{\mathbf{F}_q}}{\ov{\mathbf{F}_q}}{u}{u^{q_x}}.$$ In the sequel we will denote by $\Frob^{\mathrm{geom}}_{k_x}$ its inverse, also called the {\em geometric Frobenius}. The lifts of the (geometric) Frobenius therefore define a (left) $I_{\{x\}}$-class in the decomposition subgroup which we denote by $$\Fr_{\{x\}}\subset D_{\{x\}}$$ and
which we call the Frobenius class at $\{x\}$.

\begin{remark}\label{abuse} The choice of a different extension $v_{\{x\}'}$ of $v_x$ yields a priori another decomposition, inertia subgroups and Frobenius class, $D_{\{x\}'}, I_{\{x\}'},\ Fr_{\{x\}'}$, but these are conjugate to $D_{\{x\}}, I_{\{x\}},\ Fr_{\{x\}}$ because $G^{\mathrm{arith}}$ acts transitively on the set of extensions. As we will see the various quantities that we will discuss in relation to these sets will be conjugacy-invariant and therefore depend only on $x$ but not of a choice of $\{x\}$ and will use the indice $x$ instead of $\{x\}$. Sometimes, to simplify notations, we will implicitly assume the choice of an $\{x\}$ without mentioning it and will simply write $D_x, I_x, \Fr_x$
\end{remark}

We can now explain the term unramified.

\begin{definition} Given $x$ a closed point of $\mathbf{P}^1_{{\mathbf{F}_q}}$, a $G^{\mathrm{arith}}$-module $V$ is unramified (or lisse) at $x$ at if for one (or equivalently any) extension $\{x\}$, the corresponding inertia subgroup $I_{\{x\}}$ acts trivially  on $V$. Otherwise $V$ is ramified at $x$.

If $V$ is unramified at $x$, all the elements in the Frobenius class $\Fr_{\{x\}}$
 act by the same automorphism of $V$ and we will denote this automorphism by $(\Fr_{\{x\}}|V)$.

 Moreover if we change the extension $\{x\}$ we obtain an automorphism which is $G^{\mathrm{arith}}$-conjugate to $(\Fr_{\{x\}}|V)$. We denote by $(\Fr_x|V_\mathcal{F})$ this conjugacy class.

 \end{definition}

 It follows from this discusion that for any sheaf $\mathcal{F}$ there is a non-empty open subset on which $\mathcal{F}$ is unramified and maximal for this property. We will note this open set $U_\mathcal{F}$.

\subsection{The trace function attached to a lisse sheaf}

Let $\mathcal{F}$ be an $\ell$-adic sheaf lisse on $U\subset\mathbf{A}^1_{{\mathbf{F}_q}}$ and $$\rho_\mathcal{F}\colon G^{\mathrm{arith}}\to \GL(V_\mathcal{F})$$ the corresponding representation.

For $x\in U({\mathbf{F}_q})$ a closed point of degree $1$ at which the representation $\rho_\mathcal{F}$ is unramified, we have, in the previous section, associated a Frobenius conjugacy class $(\Fr_{x}|V_\mathcal{F})$
namely the union of all the $(\Fr_{\{x\}}|V_\mathcal{F})$. By conjugacy, the trace of all these automorphisms $(\Fr_{\{x\}}|V_\mathcal{F})$
 is constant within that class: we denote this common value by
 $$\tr(\Fr_{x}|V_\mathcal{F})$$
 and call it the Frobenius trace of $\mathcal{F}$ at $x$.

\begin{definition}
Given an $\ell$-adic sheaf $\mathcal{F}$ lisse on $U\subset \mathbf{A}^1_{{\mathbf{F}_q}}$; the trace function $K_\mathcal{F}$ associated to this situation is the function on $U({\mathbf{F}_q})$ given by
$$x\in U({\mathbf{F}_q})\mapsto K_\mathcal{F}(x)=\tr(\Frob_x|V_\mathcal{F}).$$
This is a priori a $\ov{\mathbf{Q}_{\ell}}$-valued function but it can be considered complex-valued via the fixed embedding $\iota\colon\ov{\mathbf{Q}_{\ell}}\hookrightarrow \mathbf{C}$.
\end{definition}

\begin{remark}As we have seen in Remark \ref{closedpointsident} $U({\mathbf{F}_q})$ is identified with
$$\{x\in{\mathbf{F}_q},\ Q(x)\not=0\}\subset {\mathbf{F}_q}$$
and therefore $K_\mathcal{F}$ can be considered as a function defined on a subset of ${\mathbf{F}_q}$.
\end{remark}

\begin{remark}\label{remextension} There are several ways by which one could extend $K_\mathcal{F}$ to the whole of $\mathbf{A}^1({\mathbf{F}_q})$. The simplest way is the extension by zero outside $U({\mathbf{F}_q})$; another possible extension (called the {\em middle extension}) would be to set for any $x\in\mathbf{A}^1({\mathbf{F}_q})$,
$$K_\mathcal{F}(x):=\tr(\Frob_{\{x\}}|V_\mathcal{F}^{I_{\{x\}}})$$
where $V_\mathcal{F}^{I_{\{x\}}}\subset V_\mathcal{F}$ is the subspace of $I_{\{x\}}$-invariant vectors: the action of the Frobenius class $\Frob_{\{x\}}$ on $V_\mathcal{F}^{I_{\{x\}}}$ is well-defined and its trace does not depend on $\{x\}$. For our purpose, any of the two extensions would work (cf.~ Remark \ref{remdeligneext}).
\end{remark}

\subsection{Trace functions over $U({\mathbf{F}_{q^n}})$}
In fact, an $\ell$-adic sheaf, lisse on $U_{\mathbf{F}_q}$ give rise to a whole family of trace functions.

For any $n\geq 1$, let us consider the finite extension $\mathbf{F}_{q^n}$ let us and base change the whole situation to that field: this amounts to replace $\mathbf{P}^1_{{\mathbf{F}_q}}$ by $\mathbf{P}^1_{{\mathbf{F}_{q^n}}}$, $K={\mathbf{F}_q}(X)$ by $K_n={\mathbf{F}_{q^n}}(X)$, and the arithmetic Galois group $G^{\mathrm{arith}}$ by  $G_n^{\mathrm{arith}}=\Gal(K^{\mathrm{sep}}/K_n)$ (notice that the geometric Galois group does not change).

The group $G_n^{\mathrm{arith}}$ is a normal subgroup of $G^{\mathrm{arith}}$ (whose quotient is $\Gal({\mathbf{F}_{q^n}}/{\mathbf{F}_q})$, so we may restrict our initial Galois representation to it: in that way we obtain another $\ell$-adic sheaf denoted $\mathcal{F}_n$
 $$\rho_{\mathcal{F}_n}\colonG_n^{\mathrm{arith}}\rightarrow \GL(V_\mathcal{F})$$
 and another trace function
$$K_{\mathcal{F},n}\colon\map{U({\mathbf{F}_{q^n}})}{\mathbf{C}}{x}{\tr(\Fr_x|V_\mathcal{F})}$$
where $U({\mathbf{F}_{q^n}})$ denotes now the set of closed points of $\mathbf{P}^1_{\mathbf{F}_{q^n}}$ of degree $1$ which are contained in $U$: this set is identified with the set of irreducible monic polynomials of degree $1$ coprime with $Q$ and is therefore identified with
$$\{x\in\mathbf{F}_{q^n},\ Q(x)\not=0\}.$$  As we will see below, the existence of this sequence of auxiliary functions is very important: for instance (the Chebotareff density theorem) the full sequence $(K_{\mathcal{F},n})_{n\geq 1}$ characterizes the representation $\rho_\mathcal{F}$ up to semi-simplification.

\begin{remark}\label{remwarning} As we have remarked already one has the identifications
$$U({\mathbf{F}_q})\simeq \{x\in{\mathbf{F}_q},\ Q(x)\not=0\},\ U({\mathbf{F}_{q^n}})\simeq \{x\in{\mathbf{F}_{q^n}},\ Q(x)\not=0\}.$$
However the inclusion
$$\{x\in{\mathbf{F}_q},\ Q(x)\not=0\}\subset \{x\in{\mathbf{F}_{q^n}},\ Q(x)\not=0\}$$
 does NOT imply that the function $K_\mathcal{F}$ is "the restriction" of $K_{\mathcal{F},n}$ to $U({\mathbf{F}_q})$. More precisely, if we denote by
$x$ the closed point in $U({\mathbf{F}_q})$ associated with the polynomial $X-x\in{\mathbf{F}_q}[X]$ and by $x_n$ the closed point in $U({\mathbf{F}_{q^n}})$ associated with the same polynomial $X-x\in{\mathbf{F}_{q^n}}[X]$ one has the formula
$$K_{\mathcal{F},n}(x_n)=\tr(\Frob_{x_n}|V_\mathcal{F})=\tr(\Frob^n_{x}|V_\mathcal{F}).$$

More generally, for $d$ dividing $n$ let $\pi\in{\mathbf{F}_q}[X]$ be a monic irreducible polynomial of degree $d$ and coprime to $Q$. Then $\pi$ defines a closed point $x_\pi$ of $U$ of degree $d$. Since $d|n$, the polynomial $\pi$ splits in ${\mathbf{F}_{q^n}}$
$$\pi(X)=\prod_{i=1}^d(X-x_i)$$ and any of its roots $x_i$ defines a closed point in $U({\mathbf{F}_{q^n}})$ (corresponding to the polynomial $X-x_i\in{\mathbf{F}_{q^n}}[X]$); we then have for $i=1,\ldots,d$
\begin{equation}\label{eqwarning}
	K_{\mathcal{F},n}(x_i)=\tr(\Frob_{x_i}|V_\mathcal{F})=\tr(\Frob_{\pi}^{n/d}|V_\mathcal{F}).
\end{equation}

\end{remark}

\begin{remark} There is, a priori, no reason to limit ourselves to the affine line: if $\mathcal{C}_{{\mathbf{F}_q}}$ is any smooth geometrically connected curve over ${\mathbf{F}_q}$ with function field $K_\mathcal{C}$ (which is a finite extension of ${\mathbf{F}_q}(X)$) and any dense open subset  $U\subset\mathcal{C}$  defined over ${\mathbf{F}_q}$, an $\ell$-adic sheaf $\mathcal{F}$ on $\mathcal{C}$  lisse on some non-empty open set $U$ is a continuous representation$$\rho_\mathcal{F}\colon\Gal(K^{sep}_\mathcal{C}/K_\mathcal{C})\rightarrow \GL(V_\mathcal{F})$$
which is unramified at every closed point of $U$. \end{remark}

\subsection{The language of representations}

The definition of sheaves and trace functions in terms of Galois representations enable to use consistently the vocabulary from representation theory. For instance

\begin{itemize}
\item An $\ell$-adic sheaf is {\em irreducible} (resp.~{\em isotypic}) if the representation $\rho_\mathcal{F}$ is.
\item An $\ell$-adic sheaf is {\em geometrically irreducible} (resp.~{\em geometrically  isotypic}) if the {\em restriction} of $\rho_\mathcal{F}$ to the {\em geometric Galois group} $G^{\mathrm{geom}}$ is.
\item An $\ell$-adic sheaf is  {\em trivial} if the representation $\rho_\mathcal{F}$ is. The trace function is constant, equal to $1$.
\item An $\ell$-adic sheaf is  {\em geometrically trivial} if the {\em restriction} of $\rho_\mathcal{F}$ to the {\em geometric Galois group} $G^{\mathrm{geom}}$ is. In view of \ref{exactgalois} its trace function is a constant, say $K_\mathcal{F}(x)=\alpha$ and for any $n\geq 1$, $$K_{\mathcal{F},n}(x)=\alpha^n.$$
 \end{itemize}
 One can also create new sheaves and trace function from other sheaves.

 \begin{itemize}
\item The {\em dual sheaf} $D(\mathcal{F})$ is the contragredient representation $D(\rho_\mathcal{F})$ acting on the dual space $\Hom(V_\mathcal{F},\ov{\mathbf{Q}_{\ell}})$. This   sheaf is also lisse on $U$ and its trace function is given for $x\in U({\mathbf{F}_q})$ by
$$K_{D(\mathcal{F})}(x)=\tr(\Frob_x^{-1}|V_\mathcal{F}).$$
\item Given another sheaf $\mathcal{G}$ lisse on some $U'$, one can form the {\em direct sum sheaf} $\mathcal{F}\oplus\mathcal{G}$ whose representation is $\rho_{\mathcal{F}\oplus\mathcal{G}}=\rho_\mathcal{F}\oplus\rho_\mathcal{G}$; the sheaf is lisse (at least) on $U\cap U'$, of rank the sum of the ranks,  and its trace function is given, for $x\in U({\mathbf{F}_q})\cap U'({\mathbf{F}_q})$ by the sum
$$K_{\mathcal{F}\oplus\mathcal{G}}(x)=K_{\mathcal{F}}(x)+K_{\mathcal{G}}(x).$$
\item Given another sheaf $\mathcal{G}$ lisse on some $U'$, one can form the {\em tensor product sheaf} $\mathcal{F}\otimes\mathcal{G}$ whose representation is $\rho_{\mathcal{F}\otimes\mathcal{G}}=\rho_\mathcal{F}\otimes\rho_\mathcal{G}$; the sheaf is lisse (at least) on $U\cap U'$, of rank the product of the ranks, and its trace function is given, for $x\in U({\mathbf{F}_q})\cap U'({\mathbf{F}_q})$ by the product
$$K_{\mathcal{F}\otimes\mathcal{G}}(x)=K_{\mathcal{F}}(x)K_{\mathcal{G}}(x).$$
 \item As a special case, one construct the {\em sheaf of homomorphisms} between $\mathcal{F}$ and $\mathcal{G}$ and the {\em sheaf of endomorphisms} of $\mathcal{F}$,
$$\mathrm{Hom}(\mathcal{F},\mathcal{G})=D(\mathcal{F})\otimes\mathcal{G} ,\ \mathrm{End}(\mathcal{F})=D(\mathcal{F})\otimes \mathcal{F}.$$
\item Let $H\subset\GL(V_\mathcal{F})$ be an algebraic group containing $\rho_\mathcal{F}(G^{\mathrm{arith}})$ and let $r\colon H\to \GL(V')$ be a finite-dimensional continuous $\ell$-adic representation; the composite representation $r\circ \rho_\mathcal{F}$ defines an $\ell$-adic sheaf, denoted $r\circ\mathcal{F}$, which is lisse on $U$ and has rank $\dim V'$. Its trace function  is given, for $x\in U({\mathbf{F}_q})$ by
$$K_{r\circ \mathcal{F}}(x)=\tr(r(\Frob_x|V_\mathcal{F})|V').$$

 \item Let $f\in{\mathbf{F}_q}(X)$ be non-constant; we can view $f$ as a non-constant morphism $\mathbf{P}^1_{{\mathbf{F}_q}}\to \mathbf{P}^1_{{\mathbf{F}_q}}$. The Galois subgroup  corresponding to this covering $$\Gal(K^{\mathrm{sep}}/{\mathbf{F}_q}(f(X)))\subset G^{\mathrm{arith}}$$ is isomorphic to $G^{\mathrm{arith}}$  and therefore the restriction of $\rho_{\mathcal{F}}$ to $\Gal(K^{\mathrm{sep}}/{\mathbf{F}_q}(f(X)))$ defines an $\ell$-adic sheaf on $\mathbf{P}^1_{{\mathbf{F}_q}}$ lisse on $f^{-1}(U)$ which is denoted $f^*\mathcal{F}$ and is called the {\em pull-back} of $\mathcal{F}$ by $f$. Its rank equals the rank of $\mathcal{F}$ and its trace function  is given, for $x\in f^{-1}(U)({\mathbf{F}_q})-\{\infty\}$ by
 $$K_{f^*\mathcal{F}}(x)=K_\mathcal{F}(f(x)).$$

 \item If the sequel, we will use this pull-back sheaf construction for the following morphisms:  This are special cases of {\em fractional linear transformations}: given $\gamma=\begin{pmatrix}a&b\\c&d \end{pmatrix}\in\PGLd({\mathbf{F}_q})$ (the group of automorphisms of $\mathbf{P}^1_{{\mathbf{F}_q}}$) one defines the automorphism
$$[\gamma]\colon x\to \frac{ax+b}{cx+d}.$$
We denote the pull-back sheaf by $\gamma^*\mathcal{F}$. In particular, for $\gamma=n(b)=\begin{pmatrix}1&b\\0&1 \end{pmatrix}$ we obtain the
the additive translation map
 $[+b]\colon x\to x+b$, and for $\gamma=t(a)=\begin{pmatrix}a&0\\0&1 \end{pmatrix},\ a\not=0$ we obtain the multiplicative translation map $[\times a]\colon x\to ax.$

 \end{itemize}

\subsection{Purity}
We will be interested in the size of trace functions. For this we need the notion of {\em purity}.

\begin{definition} Let $w\in\mathbf{Z}$. an $\ell$-adic sheaf $\mathcal{F}$, lisse on $U$ is punctually pure of weight $w$ if, for any $x\in U_{{\mathbf{F}_q}}$, the eigenvalues of $(\Frob_x|V_\mathcal{F})$ are complex numbers\footnote{via the fixed embedding $\ov{\mathbf{Q}_{\ell}}\hookrightarrow\mathbf{C}$.} of modulus $q_x^{w/2}$. It is mixed of weights $\leq w$ if (as a representation) it is a successive extension of sheaves punctually pure of weights $\leq w$.

In particular, if $\mathcal{F}$ is mixed of weights $\leq w$, one has for any $x\in U({\mathbf{F}_q})$
\begin{equation}\label{infinitybound}
|K_\mathcal{F}(x)|\leq \rk(\mathcal{F})q^{w/2}.
\end{equation}

\end{definition}

\begin{remark}
 It is always possible to reduce to the case of $\ell$-adic sheaves mixed of weight $w=0$. For any $w\in\mathbf{Z}$ there exist an $\ell$-adic sheaf denoted $\ov{\mathbf{Q}_{\ell}}({w/2})$ of rank $1$, lisse on $\mathbf{P}^1_{\mathbf{F}_q}$, whose restriction to $G^{\mathrm{geom}}$ is trivial and such that $\Fr_x$ acts by multiplication by $q_x^{-w/2}$ (in particular $\ov{\mathbf{Q}_{\ell}}({w/2})$ is pure of weight $-w$). Given $\mathcal{F}$ of some weight $w'$, the tensor product
 $$\mathcal{F}(w/2):=\mathcal{F}\otimes \ov{\mathbf{Q}_{\ell}}({w/2})$$
 has weight $w'-w$ and has trace function given by
 $$x\mapsto q^{-w/2}K_\mathcal{F}(x).$$
 \end{remark}

 In the sequel, unless stated otherwise, we will always assume that trace functions are associated with sheaves which are mixed of weights $\leq 0$.

 \begin{remark}\label{remdeligneext} Deligne proved (\cite[Lemme (1.8.1)]{WeilII}) that for a sheaf punctually pure of weight $w$, for any closed point $x\in\mathbf{P}^1_{\mathbf{F}_q}$, the eigenvalues of
$(\Frob_x|V_\mathcal{F}^{I_x})$ have modulus $\leq q_x^{w/2}$. In particular
$$|\tr(\Frob_x|V_\mathcal{F}^{I_x})|\leq \rk(\mathcal{F})q_x^{w/2}.$$
In particular (assuming that $w=0$) $\ell^\infty$-norm of the difference between the extension by $0$ of $K_\mathcal{F}$ from $U({\mathbf{F}_q})$ to $\mathbf{A}^1({\mathbf{F}_q})$ and the middle-extension (described in Remark \ref{remextension}) is bounded by
$$\rk(\mathcal{F})|\mathbf{A}^1(\ov{\mathbf{F}_q})-U(\ov{\mathbf{F}_q})|.$$
As we will see, we will be interested in situations where this quantity is  bounded by an absolute constant (independent of $q$) the consequence being that whatever extension we choose between the two, it won't make much of a difference.
\end{remark}

\subsection{Other functions} There are other  functions on ${\mathbf{F}_q}$ of great interest which do not qualify as trace functions under our current definition. For instance the Dirac function at some point $a\in{\mathbf{F}_q}$
$$\delta_a(n)=\begin{cases}1&\hbox{ if }n\equiv a\mods q\\0&\hbox{ otherwise }.
\end{cases}
$$
which, extended to $\mathbf{Z}$ is the characteristic function of the arithmetic progression $a+q\mathbf{Z}$ (obviously of considerable interest for analytic number theory). It turns out that such functions can be related to trace functions in our sense by very natural transformations and this will allow us to make some progress on problems from "classical" analytic number theory.

\begin{remark} In fact this function could be interpreted as the trace function of a {\em skyscraper sheaf} supported at the closed point $a$ but we will not do this here.
\end{remark}

\subsection{Local monodromy representations}
Given $\mathcal{F}$ some $\ell$-adic sheaf, let $$D^{ram}_{\mathcal{F}}\subset \mathbf{P}^1(\ov{{\mathbf{F}_q}})-U(\ov{\mathbf{F}_q})$$ be the set of geometric points where the representation $\rho_\mathcal{F}$ is ramified, that is the inertia group $I_x$ acts non-trivially. The restricted representation
$$\rho_{\mathcal{F}|I_x}=\rho_{\mathcal{F},x}$$ is called the local monodromy representation of $\mathcal{F}$ at $x$ (cf.~Remark \ref{abuse} for the abuse of notation). Although $D^{ram}_{\mathcal{F}}$ is disjoint from $U(\ov{\mathbf{F}_q})$, this finite set of representations is fundamental to study $\mathcal{F}$ and its trace function. Let us recall  the exact sequence \cite[Chap. 1]{GKM}
$$1\rightarrow P_x\rightarrow I_x\rightarrow I_x^{tame}\rightarrow 1$$
where $I_x^{tame}$ is the {\em tame inertia quotient} and is isomorphic to $\prod_{p\not= q}\mathbf{Z}_p$, while $P_x$ is the $q$-Sylow subgroup of $I_x$ and is called the wild inertia subgroup.
\begin{definition} The sheaf is tamely ramified at $x$ if $P_x$ acts trivially on $V_\mathcal{F}$ (so that $\rho_{\mathcal{F},x}$ factors through $I_x^{tame}$) and is called wildly ramified otherwise.
\end{definition}
\subsubsection{The Swan conductor}
If the representation is wildly ramified one can measure how deep it is by means of a numerical invariant: {the Swan conductor}. The wild inertia subgroup $I_x$ is equipped with the decreasing {\em  upper numbering filtration} $I_x^{(\lambda)}$ indexed by non-negative real numbers $\lambda\geq 0$, such that $$P_x=I_x^{(>0)}=\bigcup_{\lambda>0}I_x^{\lambda}.$$ Given $V=V_\mathcal{F}$ as above there is a $P_x$-stable direct sum decomposition
$$V=\bigoplus_{\lambda\in \mathrm{Break}(V)}V(\lambda)$$ indexed by a finite set of rational numbers $ \mathrm{Break}(V)\subset \mathbf{Q}_{\geq 0}$ (the set of {\em breaks} of the $I_x$-module $V$) such that
$$V(0)=V^{P_x},\ V(\lambda)^{I_x^{(\lambda)}}=0,\ V(\lambda)^{I_x^{(\lambda')}}=V(\lambda),\ \lambda'>\lambda$$
(see \cite[Chap. 1]{GKM}). The {\em Swan conductor} is defined as
$$\swan_x(\mathcal{F})=\sum_{\lambda\in \mathrm{Break}(V)}\lambda\dim V(\lambda)$$ and turns out to be an integer \cite[Prop. 1.9]{GKM}.

In the decomposition
$$V=V(0)\oplus \bigoplus_\stacksum{\lambda\in \mathrm{Break}(V)}{\lambda>0}V(\lambda)=V(0)\oplus V(>0):=V^{tame}\oplus V^{wild}$$
the first summand is called the {\em tame part} and the remaining one the {\em wild part}.

\section{Summing trace functions over ${\mathbf{F}_q}$}
Let $K_\mathcal{F}$ be the trace function associated to a sheaf $\mathcal{F}$ lisse on $U_{\mathbf{F}_q}$. It is a function on $U({\mathbf{F}_q})$ which we may extend by zero to $\mathbf{A}^1({\mathbf{F}_q})\simeq{\mathbf{F}_q}=\mathbf{Z}/q\mathbf{Z}$.

The Grothendieck-Lefschetz trace formula provides an alternative expression for the sum of $K_\mathcal{F}$ over the whole $\mathbf{A}^1({\mathbf{F}_q})$

\begin{theorem}[Grothendieck-Lefschetz trace formula] Let $\mathcal{F}$ be lisse on $U$; there exists three finite dimensional $\ell$-adic representations of $\Gal(\ov{{\mathbf{F}_q}}/{\mathbf{F}_q})$, $H^i_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})$ such that
\begin{equation}\label{GLformula}
\sum_{x\in U({\mathbf{F}_q})}K_\mathcal{F}(x)=\sum_{x\in U({\mathbf{F}_q})}\tr(\frob_x|\mathcal{F})=\sum_{i=0}^2(-1)^i\tr(\Frob_q|H^i_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})).
\end{equation}

More generally, for any $n\geq 1$,
$$\sum_{x\in U({\mathbf{F}_{q^n}})}K_{\mathcal{F},n}(x)=\sum_{x\in U({\mathbf{F}_{q^n}})}\tr(\frob_x|\mathcal{F})=\sum_{i=0}^2(-1)^i\tr(\Frob^n_q|H^i_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})).$$
\end{theorem}
The $\ov{\mathbf{Q}_{\ell}}$-vector spaces $H^i_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})$ are the so-called compactly supported étale cohomology groups of $\mathcal{F}$ and can also be considered as $\ell$-adic sheaves over the point $\Spec({\mathbf{F}_q})$.

The above formula reduces the evaluation of averages of trace functions to that of the three summands
$$\tr(\Frob_q|H^i_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})),\ i=0,1,2,$$
we need therefore to control the dimension of these spaces as well as the size of the eigenvalues. We start with the former.

\subsection{Bounding the dimension of the cohomology groups}

 The extremal cohomology groups have a simple interpretation. First
$$H^0_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})=\begin{cases}0&\hbox{ if $U\not=\mathbf{P}^1_{{\mathbf{F}_q}}$}\\
V_\mathcal{F}^{G^{\mathrm{geom}}}&\hbox{ if $U=\mathbf{P}^1_{{\mathbf{F}_q}}$}.
\end{cases}
$$
As a $\Gal(\ov{{\mathbf{F}_q}}/{\mathbf{F}_q})$-representation, one has an isomorphism
\begin{equation}\label{H2isom}
H^2_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})\simeq V_{\mathcal{F},G^{\mathrm{geom}}}(-1)
\end{equation}
(ie $H^2_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})$ is isomorphic to the quotient of $G^{\mathrm{geom}}$-coinvariants of $V_{\mathcal{F}}$ twisted by $\ov{\mathbf{Q}_{\ell}}(-1)$). In particular, if $\mathcal{F}$ is geometrically irreducible (non geometrically trivial) or more generally geometrically isotypic (the underlying geometric irreducible representation being non trivial) one has
$$H^2_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})=0.$$
In any case, one has $$\dim H_c^0(U_{\ov{{\mathbf{F}_q}}},\mathcal{F}),\ \dim H_c^2(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})\leq\rk(\mathcal{F}).$$

The dimension of the middle cohomology group is now determined by the

\begin{theorem}[The Grothendieck-Ogg-Shafarevich formula] One has the following equality
$$\chi(U_{\ov{\mathbf{F}_q}},\mathcal{F})=\sum_{i=0}^2(-1)^i\dim H^i_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})=\rk(\mathcal{F})(2-|\mathbf{P}^1(\ov{\mathbf{F}_q})-U(\ov{\mathbf{F}_q})|)-\sum_{x\in D^{ram}_{\mathcal{F}}(\ov{\mathbf{F}_q})}\swan_x(\mathcal{F}).$$
\end{theorem}

Observe that the quantities that occur are local geometric data associated to the sheaf  yet this collection of local data provides global informations.

We then define the following ad-hoc numerical invariant which serves as a measure of the complexity of the sheaf $\mathcal{F}$:
\begin{definition} The conductor of $\mathcal{F}$ is defined via the following formula
$$C(\mathcal{F})=\rk(\mathcal{F})+|\mathbf{P}^1(\ov{\mathbf{F}_q})-U(\ov{\mathbf{F}_q})|+\sum_{x\in D^{ram}_{\mathcal{F}}(\ov{\mathbf{F}_q})}\swan_x(\mathcal{F}).$$
\end{definition}
In view of this definition we have
\begin{equation}\label{eqdimbound}
\sum_{i=0}^2\dim H^i_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})\ll C(\mathcal{F})^2.
\end{equation}

\subsection{Examples}
\subsubsection{The trivial sheaf} The trivial representation $\ov{\mathbf{Q}_{\ell}}$ is everywhere lisse, pure of weight $0$, of rank $1$ and conductor $1$ and
$$K_{\ov{\mathbf{Q}_{\ell}}}(x)=1.$$
\subsubsection{Kummer sheaf \cite{sga4h}} For any non-trivial Dirichlet character
$\chi\colon({\mathbf{F}^\times_q},\times)\to \mathbf{C}^\times$ there exists an $\ell$-adic sheaf (a Kummer sheaf) denoted $\mathcal{L}_\chi$ which is of rank $1$, pure of weight $0$, lisse on $\mathbf{G}_{m,{\mathbf{F}_q}}=\mathbf{P}^1_{\mathbf{F}_q}-\{0,\infty\}$ with trace function
$$K_{\mathcal{L}_\chi}(x)=\chi(x),\ K_{\mathcal{L}_\chi,n}(x)=\chi(\nr_{{\mathbf{F}_{q^n}}/{\mathbf{F}_q}}(x))=:\chi_n(x)$$
and conductor
$$C(\mathcal{L}_\chi)=3;$$
indeed $\swan_0(\mathcal{L}_\chi)=\swan_\infty(\mathcal{L}_\chi)=0$.

\subsubsection{Artin-Schreier sheaf \cite{sga4h}} For any additive character $\psi\colon({\mathbf{F}_q},+)\to \mathbf{C}^\times$ there exists an $\ell$-adic sheaf (an Artin-Schreier sheaf) denoted $\mathcal{L}_\psi$ which is of rank $1$, pure of weight $0$, lisse on $\mathbf{A}^1_{{\mathbf{F}_q}}=\mathbf{P}^1_{\mathbf{F}_q}-\{\infty\}$ with trace function
$$K_{\mathcal{L}_\psi}(x)=\psi(x),\ K_{\mathcal{L}_\psi,n}(x)=\psi(\tr_{{\mathbf{F}_{q^n}}/{\mathbf{F}_q}}(x))=:\psi_n(x)$$
and conductor (if $\psi$ is non-trivial)
$$C(\mathcal{L}_\psi)=3.$$
(indeed $\swan_\infty(\mathcal{L}_\psi)=1$). If $f\in{\mathbf{F}_q}(X)-{\mathbf{F}_q}$, the pull-back sheaf $\mathcal{L}_{\psi(f)}$ is geometrically irreducible and has conductor
$$1+\hbox{ number of poles of $f$}+\hbox{ sum of multiplicities of the poles of $f$}.$$
More generally any character $\psi$ of $({\mathbf{F}_{q^n}},+)$ is of the shape
$$x\mapsto \psi_1(\tr_{{\mathbf{F}_{q^n}}/{\mathbf{F}_q}}(ax))$$
for $\psi_1$ a non-trivial character of $({\mathbf{F}_q},+)$ and $a\in{\mathbf{F}_{q^n}}$,  and associated to each such character is an Artin-Schreier sheaf $\mathcal{L}_\psi$.

\subsubsection{(hyper)-Kloosterman sheaves \cite{GKM}} Hyper-Kloosterman sums are formed by multiplicative convolution out of additive characters.

Given $K_1,K_2\colon{\mathbf{F}^\times_q}\rightarrow\mathbf{C}$ one defines their (normalized) multiplicative convolution:
$$K_1\star K_2\colon x\in{\mathbf{F}^\times_q}\to \frac{1}{q^{1/2}}\sum_\stacksum{x_1,x_2\in{\mathbf{F}^\times_q}}{x_1.x_2=x}K_1(x_1)K_2(x_2)=\frac{1}{q^{1/2}}\sum_{x_1\in{\mathbf{F}^\times_q}}K_1(x_1)K_2(x/x_1).$$
Similarly for any $n\geq 1$ one defines the multiplicative convolution of $K_{1,n},K_{2,n}\colon {\mathbf{F}^\times_{q^n}}\rightarrow\mathbf{C}$ as
$$K_{1,n}\star K_{2,n}\colon x\in{\mathbf{F}^\times_{q^n}}\to \frac{1}{q^{n/2}}\sum_\stacksum{x_1,x_2\in{\mathbf{F}^\times_{q^n}}}{x_1.x_2=x}K_{1,n}(x_1)K_{2,n}(x_2).$$
Now, given  a non-trivial additive character $\psi$ of ${\mathbf{F}_q}$ and $k\geq 2$, the hyper-Kloosterman sums can be expressed as the $k$-fold multiplicative convolutions of $\psi$:
$$\Kl_{k,\psi}(x;q)=\star_{k\hbox{ times}}\psi(x)=\frac{1}{q^{({k-1})2}}\sum_\stacksum{x_1,\ldots,x_k\in{\mathbf{F}^\times_q}}{x_1.\ldots.x_k=x}\psi(x_1+\ldots+x_k)$$
and more generally, one defines hyper-Kloosterman sums over ${\mathbf{F}^\times_{q^n}}$
$$\Kl_{k,\psi}(x;q^n)=\star_{k\hbox{ times}}\psi_n(x)=\frac{1}{q^{n({k-1})2}}\sum_\stacksum{x_1,\ldots,x_k\in{\mathbf{F}^\times_{q^n}}}{x_1.\ldots.x_k=x}\psi_n(x_1+\ldots+x_k).$$
These are in fact trace functions: their underlying sheaves were constructed by Deligne and were subsequently studies in depth by Katz \cite{GKM}:
\begin{theorem} For any $k\geq 2$, there exists an $\ell$-adic sheaf (the Kloosterman sheaf) denoted $\mathcal{K}\ell_{k,\psi}$, of rank $k$, pure of weight $0$, geometrically irreducible, lisse on $\mathbf{G}_{m,{\mathbf{F}_q}}$ with trace function
$$K_{\mathcal{K}\ell_{k,\psi}}(x)=\Kl_{k,\psi}(x;q)$$
and more generally, for any $n\geq 1$
$$K_{\mathcal{K}\ell_{k,\psi},n}(x)=\Kl_{k,\psi}(x;q^n).$$
One has $\swan_0(\mathcal{K}\ell_{k,\psi})=0$ and $\swan_\infty(\mathcal{K}\ell_{k,\psi})=1$ so that the conductor of that sheaf equals
$$C(\mathcal{K}\ell_{k,\psi})=k+2+1.$$
The Kloosterman sheaves have trivial determinant
$$\det\mathcal{K}\ell_k=\ov{\mathbf{Q}_{\ell}}$$
and if (and only if) $k$ is even, the Kloosterman sheaf $\mathcal{K}\ell_k$ is self-dual:
$$D(\mathcal{K}\ell_k)\simeq \mathcal{K}\ell_k.$$
\end{theorem}
\begin{remark}
	When $\psi(\cdot)=\mathrm{e}_q(\cdot)$ we will not mention the additive character $\mathrm{e}_q$ in the notation.
\end{remark}

\subsection{Deligne's Theorem on the weight}
Now that we control the dimension of the cohomology groups occurring in the Grothendieck-Lefschetz trace formula, it remains to control the size of their Frobenius eigenvalues. Suppose that $\mathcal{F}$ is pure of weight $0$ so that
$$|K_\mathcal{F}(x)|\leq \rk(\mathcal{F}).$$
As we have seen, as long as $U\not=\mathbf{P}^1$, $H^0_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})=0$.

By \eqref{H2isom}, the eigenvalues of $\Frob_q$ acting on $H^2_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})$ are of the form $$q\alpha_i,\ i=1,\ldots,\dim(V_{\mathcal{F},G^{\mathrm{geom}}})\hbox{ with }|\alpha_i|=1.$$
The trace of the Frobenius on the middle cohomology group $\tr(\Frob_q|H^1_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F}))$ is much more mysterious but fortunately we have the following theorem of Deligne \cite{WeilII}.
\begin{theorem}[The Generalized Riemann Hypothesis for finite fields]\label{delignethm} The eigenvalues of $\Frob_q$ acting on $H^1_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F})$ are complex numbers of modulus $\leq q^{1/2}$.
\end{theorem}
We deduce from this
\begin{corollary}\label{delignecor} Let $\mathcal{F}$ be an $\ell$-adic sheaf lisse on some $U$ pure of weight $0$; one has
$$\sum_{x\in{\mathbf{F}_q}}K_\mathcal{F}(x)-{\tr(\Frob_q|H^2_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F}))}\ll C(\mathcal{F})^2q^{1/2}.$$
More generally for any $n\geq 1$
$$\sum_{x\in{\mathbf{F}_{q^n}}}K_{\mathcal{F},n}(x)-{\tr(\Frob^n_q|H^2_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F}))}\ll C(\mathcal{F})^2q^{n/2}.$$
In particular if $\mathcal{F}$ is geometrically irreducible or isotypic with no trivial component, one has
$$\sum_{x\in{\mathbf{F}_q}}K_\mathcal{F}(x)\ll C(\mathcal{F})^2q^{1/2}.$$
Here, the implied constants are absolute.
\end{corollary}
In practical applications we will be faced with situations where we have a sequence of sheaves $(\mathcal{F}_q)_q$ indexed by an infinite set of primes (with $\mathcal{F}_q$ a sheaf over  the field ${\mathbf{F}_q}$) such that the sequence of conductors $(C(\mathcal{F}_q))_q$ remains uniformly bounded (by $C$ say). In such situation, the above formula represents an asymptotic formula as $q\rightarrow\infty$ for the sum of $q-O(1)$ terms
$$\sum_{x\in U({\mathbf{F}_q})}K_\mathcal{F}(x)$$
with main term ${\tr(\Frob_q|H^2_c(U_{\ov{{\mathbf{F}_q}}},\mathcal{F}))}$ (possibly $0$) and an error term of size $\ll C^2q^{1/2}$.

\section{Quasi-orthogonality relations}

We will often apply the trace formula and Deligne's theorem to the following sheaf: given $\mathcal{F}$ and $\mathcal{G}$ two $\ell$-adic sheaves both lisse on some non-empty open set $U\subset\mathbf{A}^1_{{\mathbf{F}_q}}$ and both pure of weight $0$; consider the tensor product $\mathcal{F}\otimes D(\mathcal{G})$. This sheave is also lisse on $U$ and pure of weight $0$, moreover from the definition of the conductor (see \cite[Chap. 1]{GKM}) one sees that
\begin{equation}\label{conductortensor}
C(\mathcal{F}\otimes D(\mathcal{G}))\leq C(\mathcal{F})C(\mathcal{G}).
\end{equation}
The trace functions of $\mathcal{F}\otimes  D(\mathcal{G})$ are given for $x\in U({\mathbf{F}_{q^n}})$ by
$$x\mapsto K_{\mathcal{F}\otimes D(\mathcal{G}),n}(x)=K_{\mathcal{F},n}(x)\ov{K_{\mathcal{G},n}(x)}.$$
Therefore the trace formula can be used to evaluate the correlation sums between the trace function of $\mathcal{F}$ and $\mathcal{G}$,
$$\mathcal{C}(\mathcal{F},\mathcal{G}):=\frac{1}{q}\sum_{x\in {\mathbf{F}_q}}K_{\mathcal{F}}(x)\ov{K_{\mathcal{G}}(x)};$$
more generally for any $n\geq 1$ we set
$$\mathcal{C}_n(\mathcal{F},\mathcal{G}):=\frac{1}{q^n}\sum_{x\in {\mathbf{F}_{q^n}}}K_{\mathcal{F},n}(x)\ov{K_{\mathcal{G},n}(x)}.$$
Indeed, by Corollary \ref{delignecor}, one has
\begin{equation}\label{corrn}
\mathcal{C}_n(\mathcal{F},\mathcal{G})=\tr(\Frob^n_q|V_{\mathcal{F}\otimes D(\mathcal{G}),G^{\mathrm{geom}}})+O(\frac{C(\mathcal{F})C(\mathcal{G})}{q^{n/2}}).
\end{equation}
In particular if $C(\mathcal{F})C(\mathcal{G})$ are bounded while $q^n\rightarrow\infty$, one obtains an asymptotic formula whose main term is given by the trace of the powers of Frobenius acting on the coinvariants of $\mathcal{F}\otimes D(\mathcal{G})\simeq \Hom(\mathcal{G},\mathcal{F})$.

\subsection{Decomposition of sheaves and trace functions}
Using first a weaker version of the formula (with an error term converging to $0$ as $n\rightarrow\infty$), Deligne, on his way to the proof of Theorem \ref{delignethm}, established that any $\ell$-adic sheaf pure of weight $0$ is geometrically semi-simple (the representation $\rho_{\mathcal{F}|G^{\mathrm{geom}}}$ decomposes into a direct sum of irreducible representations (of $G^{\mathrm{geom}}$)) \cite[Th\'eor\`eme (3.4.1)]{WeilII}; the irreducible components occurring in the decomposition of $\rho_{\mathcal{F}|G^{\mathrm{geom}}}$ are called the {\it geometric irreducible components of $\mathcal{F}$.}

This is not exactly valid for the arithmetic representation, but considering its semi-simplification, one obtains a decomposition
$$\rho^{ss}_{\mathcal{F}}=\bigoplus_{i\in I}\rho_{\mathcal{F}_i}$$
where the $\rho_{\mathcal{F}_i}$ are arithmetically irreducible (and pure) and lisse on $U$. Regarding geometric reducibility, each $\rho_{\mathcal{F}_i}$ is either geometrically isotypic or is induced from a representation of $\Gal(K^{\mathrm{sep}}/k.K)$ for $k$ some finite extension of ${\mathbf{F}_q}$. Since semi-simplification does not change the trace function, we obtain a decomposition of the trace function
$$K_\mathcal{F}=\sum_i K_{\mathcal{F}_i}.$$
Moreover a computation shows that whenever $\mathcal{F}_i$ is induced one has $K_{\mathcal{F}_i}\equiv 0$ on $U({\mathbf{F}_q})$. Therefore we obtain
\begin{proposition}\label{propdecomp} The trace function associated to some punctually pure sheaf $\mathcal{F}$ lisse on $U$ can be decomposed into the sum of $\leq C(\mathcal{F})$  trace functions associated to sheaves $\mathcal{F}_i$, that are lisse on $U$, punctually pure of weight $0$, geometrically isotypic with conductors $C(\mathcal{F}_i)\leq C(\mathcal{F})$.
\end{proposition}
This proposition   reduces the study of trace functions to trace functions associated to geometrically isotypic or (most of the time) geometrically irreducible sheaves. From now  on (unless stated otherwise) we will assume that the trace functions are associated to sheaves that are punctually pure of weight $0$ and geometrically isotypic. To ease notations, we say that such sheaves are "isotypic" or "irreducible" omitting the mention "geometrically" and likewise will speak of isotypic or irreducible trace functions. In such situation, using Schur lemma, the formula for \eqref{corrn} specializes to the
\begin{theorem}[Quasi-orthogonality relations]\label{thmcorrelation} Supppose that $\mathcal{F}$ and $\mathcal{G}$ are both geometrically isotypic with $n_\mathcal{F}$ copies of the irreducible component $\ov\mathcal{F}_{irr}$ for $\mathcal{F}$ and $n_\mathcal{G}$ copies of the irreducible component $\ov\mathcal{G}_{irr}$ for $\mathcal{G}$. There exists $n_\mathcal{F}.n_\mathcal{G}$ complex numbers $\alpha_{i,\mathcal{F},\mathcal{G}}$ of modulus $1$ such that
\begin{equation}\label{quasiorth1}
\mathcal{C}_n(\mathcal{F},\mathcal{G})=(\sum_{i=1}^{n_\mathcal{F} n_\mathcal{G}}\alpha^n_{i,\mathcal{F},\mathcal{G}})\delta_{\ov\mathcal{F}\sim_{geom}\mathcal{G}}+O(C(\mathcal{F})^2C(\mathcal{G})^2q^{-n/2}).
\end{equation}
In particular if $\mathcal{F}$ and $\mathcal{G}$ are both geometrically irreducible there exist $\alpha_{\mathcal{F},\mathcal{G}}\in\mathbf{S}^1$ such that
\begin{equation}\label{quasiorth2}
\mathcal{C}_n(\mathcal{F},\mathcal{G})=\alpha^n_{\mathcal{F},\mathcal{G}}\delta_{\ov\mathcal{F}\sim_{geom}\mathcal{G}}+O(C(\mathcal{F})^2C(\mathcal{G})^2q^{-n/2}).
\end{equation}
In both \eqref{quasiorth1} and  \eqref{quasiorth2} the implicit constants are independent of $n$.
\end{theorem}
\begin{remark}
 Observe that for $\mathcal{F}$ and $\mathcal{G}$ either the Kummer or Artin-Schreier sheaves these equalities correspond to the orthogonality relations of characters.
\end{remark}
\begin{remark} If two geometrically irreducible sheaves $\mathcal{F},\mathcal{G}$ are geometrically isomorphic, then their trace functions are proportional: more precisely one has for any $n$
$$K_{\mathcal{F},n}=\alpha^n_{\mathcal{F},\mathcal{G}}K_{\mathcal{G},n}$$
where $\alpha_{\mathcal{F},\mathcal{G}}$ is the complex number of modulus $1$ introduced in the previous statement.

\end{remark}

When $q^n$ is large compared to $C(\mathcal{F})^2C(\mathcal{G})^2$, the above formula gives a useful criterion to detect whether $\mathcal{F}$ and $\mathcal{G}$ have geometric irreducible components in common. While our focus is on the case $n=1$ and $q\rightarrow\infty$ (while $C(\mathcal{F})^2C(\mathcal{G})^2$ remains bounded), the case $n\rightarrow\infty$ will also prove useful. We start with the following easy lemma
\begin{lemma} Given $\alpha_1,\ldots,\alpha_d\in\mathbf{S}^1$, arbitrary  complex numbers of modulus $1$, one has
$$\limsup_{n\rightarrow\infty}(\alpha_1^n+\ldots+\alpha_d^n)=d.$$
\end{lemma}
Using this lemma together with the decomposition into irreducible representations, one obtains the following
\begin{corollary}[Katz's Diophantine criterion for irreducibility] Let $\mathcal{F}$ be an $\ell$-adic sheaf lisse on $U$ pure of weight $0$ with decomposition into geometrically irreducible subsheaves denoted
$$\mathcal{F}^{geom}=\bigoplus_i\ov{\mathcal{F}}_{i}^{\oplus n_{i}}.$$
Then
$$\limsup_{n\rightarrow\infty}\mathcal{C}_n(\mathcal{F},\mathcal{F})=\sum_{\ov\mathcal{F}_{i}}n_{i}^2.$$
In particular,
$\mathcal{F}$ is geometrically irreducible if and only if
$$\limsup_{n\rightarrow\infty}\mathcal{C}_n(\mathcal{F},\mathcal{F})=1.$$
\end{corollary}

\subsection{Counting trace functions}
The above orthogonality relations lead to upper bounds for the number of geometric isomorphism classes of $\ell$-adic sheaves of bounded conductor (see \cite{MRL} for the proof):
\begin{theorem} Let $C\geq 1$, the number of geometric isomorphism classes of geometrically irreducible $\ell$-adic sheaves of conductor $\leq C$ is finite and bounded by
$$q^{O(C^6)}$$
where the implied constant is absolute.
\end{theorem}

\proof The principle of the proof is as follows: the sheaf-to-trace-function map $\mathcal{F}\to t_\mathcal{F}$ associates to the geometric isomorphism class of some sheaf a line in the $q$-dimensional Hermitian space $\mathbf{C}^{{\mathbf{F}_q}}$ of complex-valued functions on ${\mathbf{F}_q}$ with inner product
$$\peter{K,K'}=\frac{1}{q}\sum_{x\in{\mathbf{F}_q}}K(x)\ov{K'}(x).$$
The quasi-orthogonality relations show that these different lines are almost orthogonal to one another and so one obtains a number of almost orthogonal (circles of) unit vectors in the corresponding unit sphere. A sphere-packing argument for high-dimensional hermitian spaces (see \cite{kale}) implies that the number of such vectors cannot be too large.\qed

\section{Trace functions over short intervals}\label{Secshort}
In the next few sections, we discuss the correlations between trace functions and  other classical arithmetic functions. Indeed given a trace function
$$K_\mathcal{F}\colon \mathbf{A}^1({\mathbf{F}_q})={\mathbf{F}_q}\rightarrow \mathbf{C}$$
(extended from $U({\mathbf{F}_q})$ to $\mathbf{A}^1({\mathbf{F}_q})$ either by zero or by the middle-extension) we obtain a $q$-periodic function on $\mathbf{Z}$ (which we also denote by $K_\mathcal{F}$) via the $\mods q
$-map
$$K=K_\mathcal{F}\colon \mathbf{Z}\to \mathbf{Z}/q\mathbf{Z}=\mathbf{A}^1({\mathbf{F}_q})\rightarrow \mathbf{C}.$$ Given some other arithmetic function
$\lambda\colon \mathbf{N}\rightarrow \mathbf{C}$ it is natural to compare them by evaluating their correlation sums
$$\sum_{n\leq N} K(n)\ov{\lambda(n)}$$
as $N\rightarrow\infty$ (in suitable ranges of interest depending on $C(\mathcal{F})$ and $\lambda$).

\subsection{The P\'olya-Vinogradov method}
 We start with the basic case where $\lambda=1_I$ is the characteristic function of an interval $I$ of $\mathbf{Z}$ (which we may assume is contained in $[0,q-1]$). We want to evaluate non-trivially the sum
$$S(K;I):=\sum_{n\in I}K(n).$$
Remember that we mayand do  assume that $\mathcal{F}$ is geometrically isotypic and that if $I= [0,q-1]$ such sum can be dealt with by Deligne's theorem.

By Parseval, one has
$$S(K;I)=\sum_{y\in {\mathbf{F}_q}}\widehat K(y)\ov{\widehat{1_I}}(y)$$
where
\begin{equation}\label{eqfourier}
\widehat K(y)=\frac{1}{q^{1/2}}\sum_{x\in{\mathbf{F}_q}}K(x)\mathrm{e}_q(xy)
\end{equation}
 and
$$\widehat{1_I}(y)=\frac{1}{q^{1/2}}\sum_{x\in I}\mathrm{e}_q(xy)$$
are the (normalized) Fourier transforms of $K$ and $1_I$ (for the abelian group $({\mathbf{F}_q},+)$).
One has
$$|\widehat{1_I}(y)|\ll \frac{1}{q^{1/2}}\min(|I|,\|\frac yq\|^{-1})
\ll \frac{1}{q^{1/2}}\min(|I|,\frac q{|y|})$$
(here $\|y/q\|$ denote the distance to the nearest integer) which implies that
$$\|\widehat{1_I}\|_1\ll \frac{|I|}{q^{1/2}}+q^{1/2}\log q.$$
Therefore one has
$$\sum_{n\in I}K(n)\ll \|\widehat K\|_\infty q^{1/2}\log q.$$
This leads us to look at the size of the Fourier transform $y\mapsto \widehat K(y)$. If $K$ is of the shape $\mathrm{e}_q(ax)$ for some $a\in{\mathbf{F}_q}$, its Fourier transform is a Dirac function
$$\widehat K(y)=q^{1/2}\delta_{y=a\mods q}$$
and is therefore highly concentrated. To avoid this we make the following
\begin{definition} An isotypic sheaf $\mathcal{F}$ is Fourier if its geometric irreducible component is not (geometrically) isomorphic to any Artin-Schreier sheaf $\mathcal{L}_\psi$.
\end{definition}
In particular, if $K$ is Fourier of conductor $C(\mathcal{F})$, it follows from Theorem \ref{thmcorrelation} that for any $y\in{\mathbf{F}_q}$
$$\widehat K(y)\ll C(\mathcal{F})^2.$$
In that way we obtain the
\begin{theorem}[P\'olya-Vinogradov bound] Let $\mathcal{F}$ be a Fourier sheaf of conductor $C(\mathcal{F})$ and $K$ its associated trace function. For any interval $I$ of length $\leq q$, one has
	$$\sum_{x\in I}K(x)\ll C(\mathcal{F})^2q^{1/2}\log q;$$
	here the implicit constant is absolute.
\end{theorem}
\begin{remark} This statement was obtained for the first time by P\'olya and Vinogradov, independently, in the case of Dirichlet characters $\chi$. In that case the Fourier transform is the normalized Gauss sum
$$\widehat\chi(y)=\varepsilon_\chi(y)=\frac{1}{q^{1/2}}\sum_{x\in{\mathbf{F}_q}}\chi(x)\mathrm{e}_q(xy)$$
which is bounded in absolute value by $1$.
\end{remark}

Observe that this bound is better than the trivial bound
$$|\sum_{x\in I}K(x)|\leq C(\mathcal{F})|I|$$
as long as $$|I|\gg_{C(\mathcal{F})}q^{1/2}\log q.$$

This range is called the {\em P\'olya-Vinogradov range} and the question of bounding non-trivially for as many trace functions as possible over shorter intervals is a   fundamental problem in analytic number theory with many striking applications. At this moment, the problem is solved only in a very limited number of cases. One important example is the celebrated work of Burgess on Dirichlet characters \cite{Bur} which we  discuss in \S \ref{Bursec}. A lot of the forthcoming lectures will indeed be concerned with breaking this barrier in specific cases or in different contexts, and to give some  applications.

\subsubsection{Bridging the P\'olya-Vinogradov range}

The following argument of Fouvry, Kowalski, Michel, Rivat, Soundararajan and Raju improves slightly the P\'olya-Vinogradov range:
\begin{theorem}\cite{FKMRRS} Let $\mathcal{F}$ be a Fourier sheaf of conductor $C(\mathcal{F})$ and $K$ its associated trace function. For any interval $I$ of length $\sqrt q<|I|\leq q$, we have
$$\sum_{x\in I}K(x)\ll C(\mathcal{F})^2q^{1/2}(1+\log(|I|/q^{1/2})).$$
\end{theorem}
\proof
Given $r\in\mathbf{Z}$, let $I_r=r+I$; this is again an interval and  $S(K;I)$ and $S(K;I_r)$ differ only by $O(\|K\|_\infty r)$, which is a useful bound when $r$ is not too large.  Moreover
$$\widehat{1_{I_r}}(y)=\mathrm{e}_q(ry)\widehat{1_I}(y).$$
We have therefore
$$S(K;I)=\sum_{|y|\leq q/2}\widehat K(y)\ov{\widehat{1_I}(y)}\frac{1}{R}\sum_{0\leq r\leq R-1}\mathrm{e}_q(-ry).$$
We choose $R=[q^{1/2}]+1$; using the bounds
$$|\widehat{1_I}(y)|\ll q^{-1/2}\min(|I|,q/|y|),\ \sum_{0\leq r\leq R-1}\mathrm{e}_q(-ry)\ll \min(R,q/|r|)$$
and
$$\|K\|_\infty+\|\widehat K\|_\infty\ll C(\mathcal{F})^2$$ we obtain the result.
\qed

\subsection{A smoothed version of the P\'olya-Vinogradov method}
Often in analytic number theory one is not faced with summing a trace function over an interval but instead against some smooth compactly supported function, for instance one has to evaluate sums of the shape
$$\sum_{n\in\mathbf{Z}}K(n)V(\frac{n}N),\ V\in C_c^\infty(\mathbf{R})\hbox{ fixed}.$$
By the Poisson summation formula  one has the identity
\begin{equation}\label{eqpoisson}
\sum_{n\in\mathbf{Z}}K(n)V(\frac{n}N)=\frac{N}{q^{1/2}}\sum_{n\in\mathbf{Z}}\widehat K(n)\widehat V(\frac{n N}q)
\end{equation}
where
$$\widehat V(y)=\int_\mathbf{R} V(x)e(xy)dx$$
is the Fourier transform of $V(x)$ (over $\mathbf{R}$).

Observe that $\widehat V(y)$ is not compactly supported but at least is of rapid decay:
$$\forall A\geq 0,\ \widehat V(y)\ll_{V,A}(1+|y|)^{-A}.$$ Therefore the dual sum in \eqref{eqpoisson} decays rapidly for $n\gg q/N$ and we obtain
\begin{proposition} We have
\begin{equation}\label{eqsmoothPV}
\sum_{n\in\mathbf{Z}}K(n)V(\frac{n}N)\ll_{V} q^{1/2}\|\widehat K\|_\infty\ll_{V,C(\mathcal{F})} q^{1/2}.
\end{equation}
\end{proposition}

\subsection{The Deligne-Laumon Fourier transform}

The Fourier transform
$$K\mapsto \widehat K\colon  y\to \frac{1}{q^{1/2}}\sum_{x\in{\mathbf{F}_q}}K(x)\mathrm{e}_q(-xy)$$
is a well-known and very useful operation on the space of function on $(\mathbf{Z}/q\mathbf{Z},+)$. It serves to realize the spectral decomposition of the functions on $\mathbf{Z}/q\mathbf{Z}$ in terms of eigenvectors of the irreducible representations (characters) of $\mathbf{Z}/q\mathbf{Z}$. Let us recall that
\begin{itemize}
\item The Fourier transform is essentially involutive: $$\widehat{\widehat K}(x)=K(-x);$$ stated otherwise, one has the Fourier inversion formula:
$$K(x)=\sum_{y\in{\mathbf{F}_q}}\widehat K(y)\mathrm{e}_q(yx).$$
\item The Fourier transform is an isometry on $L^2(\mathbf{Z}/q\mathbf{Z})$; stated otherwise, one has the Plancherel formula
$$\sum_{x\in{\mathbf{F}_q}}K(x)\ov{K'(x)}=\sum_{y\in{\mathbf{F}_q}}\widehat K(y)\ov{\widehat{K'}(y)}.$$
\item The Fourier transform behaves well with respect to  to additive and  multiplicative shifts: for $a\in{\mathbf{F}_q},\ z\in{\mathbf{F}^\times_q}$,
$$\widehat{[+a]K}(y)=\mathrm{e}_q(ay)\widehat K(y),\ \widehat{[\times z]K}(y)=[\times z^{-1}]\widehat K(y)=\widehat K(y/z).$$
\end{itemize}

A remarkable fact, due to Deligne is that, to the Fourier transform for trace functions corresponds a "geometric Fourier transform" for sheaves. The following theorem is due to G. Laumon \cite{laumon87}:
 \begin{theorem} Let $\mathcal{F}$ be a Fourier sheaf, lisse on $U$ and pure of weight $0$. There exists a Fourier sheaf $\widehat \mathcal{F}$, lisse on some open set $\widehat U$, pure of weight $0$, such that if $K_{\mathcal{F},n}$ denotes the (middle-extension of the) trace function of $\mathcal{F}$, the (middle extension of the) trace function of $\widehat\mathcal{F}$ is given by the Fourier transform $\widehat{K_{\mathcal{F},n}}$ where
	  $$\widehat {K_{\mathcal{F},n}}(x)=\frac{1}{q^{n/2}}\sum_{y}K_{\mathcal{F},n}(y)\mathrm{e}_q(\tr_{\mathbf{F}_{q^n}/{\mathbf{F}_q}}(xy)).$$
	  The map\footnote{This is in fact a functor in the derived category of constructible $\ell$-adic sheaves.} $\mathcal{F}\mapsto \widehat\mathcal{F}$ is called the geometric Fourier transform. The geometric Fourier transform satisfies (for $a\in{\mathbf{F}_q},\ z\in{\mathbf{F}^\times_q}$)

	 $$\widehat{\widehat\mathcal{F}}=[\times -1]^*\mathcal{F},\ \widehat{[+a]^*\mathcal{F}}=\mathcal{L}_{\mathrm{e}_q(a).}\otimes \widehat\mathcal{F},\ \widehat{[\times z]^*\mathcal{F}}=[\times z^{-1}]^* \widehat\mathcal{F}.$$
\end{theorem}

In addition, Laumon also defined local versions of the geometric Fourier transform making possible the computation of the local monodromy representations of $\widehat\mathcal{F}$ in terms of those of $\mathcal{F}$; using these results one deduces
\begin{proposition} Given $\mathcal{F}$ as above, one has
$$C(\widehat \mathcal{F})\leq 10 C(\mathcal{F})^2.$$
\end{proposition}

 Also the Fourier transform preserves irreducibility:

 \begin{proposition}
 The Fourier transform maps irreducible (resp.~isotypic) sheaves to irreducible (resp.~isotypic) sheaves.
 \end{proposition}
\proof

 Given $\mathcal{F}$ a geometrically irreducible sheaf pure of weight $0$, to prove that $\widehat\mathcal{F}$ is irreducible, it is enough to show (by Katz's irreducibility criterion) that
 $$\limsup_n \mathcal{C}_n(\widehat\mathcal{F},\widehat\mathcal{F})=\limsup_n \frac{1}{q^n}\sum_{x\in{\mathbf{F}_{q^n}}}|\widehat {K_{\mathcal{F},n}}(x)|^2=1$$
 but by the Plancherel formula
 $$\frac{1}{q^n}\sum_{x\in{\mathbf{F}_{q^n}}}|\widehat {K_{\mathcal{F},n}}(x)|^2=
 \frac{1}{q^n}\sum_{y\in{\mathbf{F}_{q^n}}}| {K_{\mathcal{F},n}}(y)|^2$$
 and
 $$\limsup_n \frac{1}{q^n}\sum_{y\in{\mathbf{F}_{q^n}}}| {K_{\mathcal{F},n}}(y)|^2=1$$
  by Katz's irreducibility criterion applied in the reverse direction.

\qed

 \begin{xca} Prove that the hyper-Kloosterman sheaves are geometrically irreducible ( hint: observe that the hyper-Kloosterman sums $\Kl_{k+1}$ can be expressed in terms of the Fourier transform of $\Kl_{k}$).
 \end{xca}

\section{Autocorrelation of trace functions; the automorphism group of a sheaf}

The next couple of appplications we are going to discuss involve a special type of correlation sums between a trace function and its transform by an automorphism
 of the projective line.

Let $\mathcal{F}$ be an $\ell$-adic sheaf lisse on $U\subset\mathbf{P}^1_{\mathbf{F}_q}$, pure of weight $0$, geometrically irreducible but non trivial, with conductor $C(\mathcal{F})$. Let $\gamma$ be an automorphism of $\mathbf{P}^1_{\mathbf{F}_q}$: $\gamma$ is a fractional linear transformation:
$$\gamma\colon  z\to \gamma\cdot z=\frac{az+b}{cz+d},\ \begin{pmatrix}a&b\\c&d
 \end{pmatrix}\in\PGL_2({\mathbf{F}_q}).
$$
Let $\gamma^*\mathcal{F}$ be the associated pull-back sheaf; it is lisse on $\gamma^{-1}\cdot U$ and its trace function is
$$\gamma^*K(z)=K(\gamma\cdot z)=K(\frac{az+b}{cz+d}).$$ Moreover since $\gamma$ is an automorphism of $\mathbf{P}^1_{\mathbf{F}_q}$, one has $C(\gamma^*\mathcal{F})=C(\mathcal{F})$.

The correlations sums we will consider are those of $K$ and $\gamma^*K(z)$
$$\mathcal{C}(\mathcal{F},\gamma):=\mathcal{C}(K,\gamma^*K)=\frac{1}q\sum_{z}K(z)\ov{K(\gamma\cdot z)}$$
and
$$\mathcal{C}_n(\mathcal{F},\gamma):=\mathcal{C}_n(K,\gamma^*K)=\frac{1}{q^n}\sum_{z\in{\mathbf{F}_{q^n}}}K_n(z)\ov{K_n(\gamma\cdot z)}$$
which are associated to the tensor product sheaf
$$\mathcal{F}\otimes \gamma^*D(\mathcal{F})$$
which is lisse on $U_\gamma=U\cap \gamma^{-1}\cdot U.$

\subsection{The automorphism group}
The question of the size of the sums $\mathcal{C}(\mathcal{F},\gamma)$ is largely determined by the following invariant of $\mathcal{F}$ (see \cite{FKM1,FKM2})
\begin{definition} Given $\mathcal{F}$ as above, the group of automorphisms of $\mathcal{F}$, denoted $\Aut_{\mathcal{F}}({\mathbf{F}_q})\subset\PGL_2({\mathbf{F}_q})$, is the group of $\gamma\in \PGL_2({\mathbf{F}_q})$ such that
$$\gamma^*\mathcal{F}\simeq_\mathrm{geom}\mathcal{F}.$$
The group $\Aut_{\mathcal{F}}({\mathbf{F}_q})$ is the group of ${\mathbf{F}_q}$-points of an algebraic subgroup, $\Aut_{\mathcal{F}}\hookrightarrow\PGL_{2}$ defined over ${\mathbf{F}_q}$.
Let $B\subset \PGL_2$ the subgroup generated by upper-triangular matrices; we define
$$B_\mathcal{F}:=\Aut_{\mathcal{F}}\cap B$$ the subgroup of upper-triangular matrices of $\Aut_{\mathcal{F}}$ and $B_\mathcal{F}({\mathbf{F}_q})$	the group of ${\mathbf{F}_q}$-points.
\end{definition}
The relevance of this notion for the above correlations sums is the following
\begin{proposition} For $\gamma\not\in \Aut_{\mathcal{F}}({\mathbf{F}_q})$, one has
$$\mathcal{C}(K,\gamma)=O_{C(\mathcal{F})}(q^{-1/2}).$$
\end{proposition}
In view of this proposition it is important to determine  $\Aut_{\mathcal{F}}({\mathbf{F}_q})$ and $B_\mathcal{F}({\mathbf{F}_q})$.

\begin{example}
Obviously any element of $\Aut_{\mathcal{F}}$ has to leave $\mathbf{P}^1(\ov{\mathbf{F}_q})-U(\ov{\mathbf{F}_q})$ invariant and all the points in the same orbit have isomorphic local monodromies. This may impose very strong constraints on $\Aut_{\mathcal{F}}$.

\begin{itemize}
\item If $\mathcal{F}$ is geometrically trivial then $\Aut_{\mathcal{F}}=\PGL_2$.
\item If $\psi\colon ({\mathbf{F}_q},+)\rightarrow\mathbf{S}^1$ is non trivial then $G_{\mathcal{L}_\psi}=N=\{\begin{pmatrix}1&x\\&1
\end{pmatrix}\subset\PGL_2
 \}$.
 \item If $\chi\colon ({\mathbf{F}_q},+)\rightarrow\mathbf{S}^1$ is non trivial, then $$G_{\mathcal{L}_\chi}=T^{0,\infty}=\{\begin{pmatrix}a&0\\0&d
\end{pmatrix}\subset\PGL_2
 \}$$
 is the diagonal torus,  unless $\chi$ is quadratic in which case $G_{\mathcal{L}_\chi}=N(T^{0,\infty})$ is the normalizer of the diagonal torus.
\item For the Kloosterman sheaves, one can show that $\mathcal{G}_{\mathcal{K}\ell_k}$ is trivial: since $\mathcal{K}\ell_k$ is not lisse at $0$ and $\infty$, with Swan conductor $0$ at $0$ and $1$ at $\infty$, one has $\mathcal{G}_{\mathcal{K}\ell_k}\subset T^{0,\infty}$. One can then show (see \cite{MiDMJ}) that $[\times a]^*{\mathcal{K}\ell_k}\simeq_\mathrm{geom}{\mathcal{K}\ell_k}$ iff $a=1$.
\end{itemize}

\end{example}

Given $x\not=y\in\mathbf{P}^1(\ov{\mathbf{F}_q})$, we denote by $T^{x,y}$ the pointwise stabilizer  of the pair $(x,y)$ (this is a maximal torus defined over some finite extension of ${\mathbf{F}_q}$) and $N(T^{x,y})$ its normalizer. The torus $T^{x,y}$ is defined over ${\mathbf{F}_q}$ if $x,y$ belong to $\mathbf{P}^1({\mathbf{F}_q})$ or if $x,y$ belong to $\mathbf{P}^1(\mathbf{F}_{q^2})$ and are Galois conjugates.

\begin{proposition}\label{thmautogroup} Suppose $q\geq 7$. Given $\mathcal{F}$ as above, at least one of the following holds:
\begin{itemize}
\item $C(\mathcal{F})>q$.
\item $q$ does not divide $|\Aut_{\mathcal{F}}({\mathbf{F}_q})|$ and either $\Aut_{\mathcal{F}}({\mathbf{F}_q})$ is of order $\leq 60$ or is a subgroup of the normalizer of some maximal torus $N(T^{x,y})$ defined over ${\mathbf{F}_q}$.
\item $q$ divides $|\Aut_{\mathcal{F}}({\mathbf{F}_q})|$ and then $\mathcal{F}\simeq \sigma^*\mathcal{L}_\psi$ for some $\psi$ and $K(x)=\alpha\psi(\sigma.x)$ for
for some $\sigma\in\PGL_2({\mathbf{F}_q})$ and $\Aut_{\mathcal{F}}({\mathbf{F}_q})=\sigma N\sigma^{-1}$.
\end{itemize}
\end{proposition}
\begin{remark}
Observe that in the last case $$\mathcal{C}(K,\gamma)=|K(0)|^2\mathcal{C}(\psi(\sigma.x),\gamma)$$
\end{remark}

Concerning the size of the group $B_\mathcal{F}({\mathbf{F}_q})$, one can show that
\begin{theorem}\label{thmautogroupB} Let $\mathcal{F}$ be an isotypic sheaf whose geometric components are not  isomorphic to $[+x]^*\mathcal{L}_\chi$ for some $x\in{\mathbf{F}_q}$ and some multiplicative character $\chi$ and such that
$$C(\mathcal{F})< q.$$
Then
$$|B_\mathcal{F}({\mathbf{F}_q})|\leq C(\mathcal{F}).$$
\end{theorem}
The proof of this theorem involves the following rigidity statements \cite[Lemma 2.6.13]{KatzRLS}:
\begin{proposition}
Let $\mathcal{L} $ be geometrically irreducible.
\begin{itemize}
\item If for some $x\in{\mathbf{F}^\times_q}$, $[+x]^*\mathcal{L}\simeq\mathcal{L}$, then either
$$C(\mathcal{L})>q\hbox{ or }\mathcal{L}\simeq \mathcal{L}_\psi \hbox{ for some } \psi.$$
\item If $\Aut_\mathcal{L}({\mathbf{F}_q})$ contains a subgroup of	 order $m$ of diagonal matrices then either
 $$c(\mathcal{L})>m\hbox{ or }\mathcal{L}\simeq\mathcal{L}_\chi \hbox{ for some } \chi.$$
\end{itemize}

\end{proposition}

\section{Trace functions vs.~primes}\label{Secprimes}

Another possible question to consider (natural from the viewpoint of analytic number theory at least) is how trace functions correlate with the characteristic function of the primes. In this section, we discuss the structure of the proof of the following result:

\begin{theorem}[Trace function vs.~primes, \cite{FKM2}]\label{thmprimesumthm}
  Let $\mathcal{F}$ be a geometrically isotypic sheaf of conductor $C(\mathcal{F})$ whose geometric components are not of the shape $\mathcal{L}_\psi\otimes\mathcal{L}_\chi$ and let $K$ its associated trace function. For any $V\in C^\infty_c(\mathbf{R}_{>0})$, one has \par
\begin{align}
\label{primesuminterval}
\sum_\stacksum{p\ \text{prime}}{p \leq X}K(p)&\ll
X(1+q/X)^{1/12}p^{-\eta/2},\\
\label{primesumsmooth}\sum_{p\ \text{prime}}K(p)V\Bigl(\frac{p}X\Bigr)&\ll
X(1+q/X)^{1/6}q^{-\eta},
\end{align}
for $X\ll q$ and $\eta<1/24$. The implicit constants depend only on $\eta$,
$C(\mathcal{F})$ and $V$. Moreover, the dependency on $C(\mathcal{F})$ is at most polynomial.
\end{theorem}

\begin{remark} This result exhibits cancellations when summing trace functions  along the primes in intervals of length larger than $q^{3/4}$. It is really a pity that Dirichlet characters are excluded by our hypotheses: such a bound in that case would amount to a quasi generalized Riemann hypothesis for the corresponding Dirichlet character $L$-function !
\end{remark}
We discuss the proof for $X=q$.

\subsection{Combinatorial decomposition of the characteristic function of the primes}
As is well-known, the problem is equivalent to bounding the sum
$$\sum_{n}\Lambda(n) K(n)V\Bigl(\frac{n}q\Bigr)$$
where $$\Lambda(n)=\begin{cases}\log p&\hbox{ if }n=p^\alpha\ \alpha\geq 1\\
0&\hbox{ otherwise, }
\end{cases}$$
 is the von Mangoldt function. A standard method in analytic number theory is a combinatorial decomposition of this function as a sum of Dirichlet convolutions; one way to achieve this is to use the celebrated Heath-Brown identity:
\begin{lemma}[Heath-Brown]  \label{lemHB}
  For any integer  $J\geq 1$ and $n< 2X$, we have
$$
\Lambda(n)=-\sum_{j=1}^J(-1)^j\binom{J}{j} \sum_{m_1,\ldots, m_j\leq
  Z}\mu(m_1)\ldots\mu(m_j) \sum_{m_1\ldots m_jn_{1}\ldots
  n_{j}=n}\log n_1,
$$
where $Z=X^{1/J}$.
\end{lemma}
Hence splitting the range of summation of the various variables appearing (using partition of unity) and separating these variables, our preferred sum decomposes (essentially) into $O((\log X)^{2J})$ sums of the shape
$$\Sigma(M_1,\ldots,M_{2j})=\sumsum_{m_1,\ldots m_{2j}}\mu(m_1)\ldots\mu(m_j) K(m_1.\ldots.m_{2j})V_{1}	\Bigl(\frac{m_{1}}{M_{1}}\Bigr)\ldots V_{2j}	\Bigl(\frac{m_{2j}}{M_{2j}}\Bigr)$$
for $j\leq J$; here $V_i,\ i=1,\ldots 2j$ are smooth  functions compactly supported in $]1,2[$, and $(M_1,\ldots,M_{2j})$ is a tuple satisfying
$$M_i=:q^{\mu_i},\ \forall i\leq j,\ \mu_i\leq 1/J,\ \sum_{i\leq 2j}{\mu_i}=1+o(1);$$
The objective is to show that
$$\Sigma(M_1,\ldots,M_{2j})\ll q^{1-\eta}$$
for some fixed $\eta>0$. We will take $J=3$ so that $Z=q^{1/3}$. We may assume that
$$\mu_1\leq\ldots\leq \mu_j\leq 1/3,\ \mu_{j+1}\leq \ldots\leq\mu_{2j}.$$
We will bound these sums differently depending on the vector $(\mu_1,\ldots,\mu_{2j})$.

Let $0<\delta<1/6$ be some small but fixed parameter to be chosen optimally later.

\begin{enumerate}

\item Suppose that  $\mu_{2j}\geq 1/2+\delta$. Then $m_{2j}$ is a long "smooth variable" (because the weight attached to it is smooth); therefore using  \eqref{eqsmoothPV} to sum over $m_{2j}$ while fixing the other variables, we get
$$\Sigma(M_1,\ldots,M_{2j})\ll q^{\mu_1+\ldots\mu_{2j-1}}q^{1/2+o(1)}=q^{1-\delta+o(1)}.$$
(In the literature, sum of that shape are called "type I" sums).

\item  We may therefore assume that $$m_{j+1}\leq \ldots\leq \mu_{2j}\leq 1/2+\delta;$$
in other words, there is no  long smooth variable.
What one can then do is to group variables together to form longer ones: for this one partitions the indexing set  into two blocks
$$\{1,\ldots,2j\}=\mathcal{I}\sqcup \mathcal{I}',$$ and form the variables
$$m=\prod_{i\in \mathcal{I}} m_i,\ n=\prod_{i'\in\mathcal{I}'}m_{i'}$$
so that denoting by $\alpha_m$  the Dirichlet convolutions
of either $\mu(\cdot)V(\frac{\cdot}{M_i})$ or $V(\frac{\cdot}{M_i})$ for $i\in\mathcal{I}$ and similarly for $\beta_n$ for $i'\in\mathcal{I}'$, we are led to bound  bilinear sums of the shape
\begin{equation}\label{eqbilineardef} B(K;\alpha,\beta)=\sumsum_{m\ll M,n\ll N}\alpha_m\beta_n K(mn).
\end{equation}
where
$$M=q^\mu,\ \mu=\sum_{i\in \mathcal{I}}\mu_i,\ N=q^\nu,\ \nu=\sum_{i'\in \mathcal{I}'}\mu_{i'}.$$
The weights $\alpha_m,\beta_n$ are rather irregular and it is difficult to exploit their structure (such sums are called "type II").

Assuming that the irreducible component of $\mathcal{F}$ is not of the shape $\mathcal{L}_\chi\otimes\mathcal{L}_\psi$, we will prove in Theorem \ref{thmbilinear} below the following bound
	$$\Sigma(M_1,\ldots,M_{2j})=B(K;\alpha,\beta)\ll_{C(\mathcal{F})}\|\alpha_M\|_2\|\beta_N\|_2(MN)^{1/2}(\frac{1}M+\frac{q^{1/2}\log q}{N})^{1/2}.$$

Assuming that $$\mu\geq {\delta}\hbox{ and }\nu\geq {1/2+\delta}$$ we obtain that
$$B(K;\alpha,\beta)\ll q^{1-\delta/2+o(1)}.$$

\item  It remains to treat the sums for which neither $\mu_{2j}\leq 1/2+\delta$ nor a decomposition as in (2) exist. This necessarily implies that $\sum_{i\leq j}\mu_i\leq 1/3,$ $j\geq 2$ and $\mu_{2j-1}+\mu_{2j}\geq 1-\delta.$
Setting $M=M_{2j-1}$ and $N=M_{2j}$  , denoting
$$a=m_1\ldots m_{2j-2}\ll q^{\delta},$$ it will be sufficient to obtain a bound of the shape
$$\sum_{m,n\geq 1}K(amn)V(\frac{m}M)W(\frac{n}N)\ll_{V,W} (MN)^{1-\eta}$$
for some $\eta>0$ whenever $MN$ is sufficiently close to $q$.
What we have are is a sum involving two smooth variables which are however too short for the P\'olya-Vinogradov method to work, but whose product is rather long. We call these sums "type I$1/2$". We will then use Theorem \ref{cortypeI1/2} below whose proof is discussed in \S \ref{sectracemodular}. Observe that this theorem provides a bound which is non trivial as long as $MN\geq q^{3/4}$.

\item Optimizing parameters in these three approaches leads to Theorem \ref{thmprimesumthm}.
\end{enumerate}

\begin{theorem}\label{cortypeI1/2} Let $\mathcal{F}$ be a geometrically  isotypic Fourier sheaf of conductor $C(\mathcal{F})$ and $K$ its associated trace function. For any $V,W\in C^\infty_c(\mathbf{R}_{>0})$, any $M,N\geq 1$ and any $\eta<1/8$, one has
$$\sum_{m,n\geq 1}K(mn)V(\frac{m}M)W(\frac{n}N)\ll_{V,W,C(\mathcal{F})} MN(1+\frac{q}{MN})^{1/2}q^{-\eta/2}.$$
\end{theorem}

\section{Bilinear sums of trace functions}\label{secbilinear}
Let $K$ be a trace function associated to some isotypic sheaf $\mathcal{F}$, pure of weight $0$ and let $(\alpha_m)_{m\leq M}$, $(\beta_n)_{n\leq N}$ be arbitrary complex numbers. In this section, we  bound the "type II" bilinear sums  encountered in the previous section :
$$B(K;\alpha,\beta)=\sumsum_{m\leq M,n\leq N}\alpha_m\beta_n K(mn).$$

Using the Cauchy-Schwarz inequality, the trivial bound is
$$|B(K;\alpha,\beta)|\ll_{C(\mathcal{F})}\|\alpha_M\|_2\|\beta_N\|_2(MN)^{1/2}.$$
We wish to improve over this bound.
\begin{theorem}[Bilinear sums of trace functions]\label{thmbilinear} Notations as above; assume that $1\leq M,N<q$ and that the irreducible component of $\mathcal{F}$ is not of the shape $\mathcal{L}_\chi\otimes\mathcal{L}_\psi$. Then
	$$B(K;\alpha,\beta)\ll_{C(\mathcal{F})}\|\alpha_M\|_2\|\beta_N\|_2(MN)^{1/2}(\frac{1}M+\frac{q^{1/2}\log q}{N})^{1/2}.$$
\end{theorem}
\begin{remark}This bound is non-trivial as soon as $M\gg 1$ and $N\gg q^{1/2}\log q$.
\end{remark}
\proof
By Cauchy-Schwarz, we have
\begin{equation}\label{eqfirstCS}
|B(K;\alpha,\beta)|^2\leq  \|\beta_N\|_2^2\sum_{m_1,m_2\leq M}\alpha_{m_1}\ov{\alpha_{m_2}}\sum_{n\leq N}K(m_1n)\ov K(m_2n).
\end{equation}
We do not expect to gain anything from the diagonal terms $m_1\equiv m_2\mods q$ (equivalently, $m_1=m_2$ since $M<q$) and the contribution of such terms is bounded trivially by
\begin{equation}\label{eqdiagbound}
\ll_{C(\mathcal{F})}\|\alpha_M\|_2^2\|\beta_N\|^2_2N.
\end{equation}
As for the non-diagonal terms, their contribution is
$$ \|\beta_N\|_2^2\sum_{m_1\not=m_2\mods q}\alpha_{m_1}\ov{\alpha_{m_2}}\sum_{n\leq N}K(m_1n)\ov K(m_2n).$$
Using the P\'olya-Vinogradov method, we are led to evaluate the Fourier transform of
$$n\mapsto K(m_1n)\ov K(m_2n).$$
By the Plancherel formula, this Fourier transform equals
\begin{eqnarray*}
y\mapsto\frac{1}{q^{1/2}}\sum_{x\in{\mathbf{F}_q}}K(m_1x)\ov K(m_2x)\mathrm{e}_q(-yx)&=&
\frac{1}{q^{1/2}}\sum_{z\in{\mathbf{F}_q}}\widehat K((z-y)/m_1)\ov {\widehat K}(z/m_2)
\\&=&\frac{1}{q^{1/2}}\sum_{z\in{\mathbf{F}_q}}\widehat K((m_2z-y)/m_1)\ov {\widehat K}(z)\\
&=&	\frac{1}{q^{1/2}}\sum_{z\in{\mathbf{F}_q}}\widehat K(\gamma z)\ov {\widehat K}(z)
\end{eqnarray*}
with
$$\gamma=\begin{pmatrix}
m_2/m_1&-y/m_1\\0&1
\end{pmatrix}\in B({\mathbf{F}_q}).
$$
This sum is $q^{1/2}$ times $\mathcal{C}(\widehat\mathcal{F},\gamma)$, the correlation sum associated to the isotypic sheaves $\widehat\mathcal{F}$ and $\gamma^*\widehat\mathcal{F}$, whose conductors are controlled in terms of $C(\mathcal{F})$.

If $\gamma\not\in B_\mathcal{F}({\mathbf{F}_q})$ we have
\begin{equation}\label{eqcorB}
\mathcal{C}(\widehat\mathcal{F},\gamma)\ll_{C(\mathcal{F})}\frac{1}{q^{1/2}}.
\end{equation}
The condition that the irreducible component of $\mathcal{F}$ is not of the shape $\mathcal{L}_\chi\otimes\mathcal{L}_\psi$ translates into the irreducible component of $\widehat\mathcal{F}$ not being of the shape $[+x]^*\mathcal{L}_{\ov\chi}$. In that case, by Theorem \ref{thmautogroupB}, there is a set $S_\mathcal{F}\subset {\mathbf{F}^\times_q}$ such that for any $(m_1,m_2,y)\in{\mathbf{F}^\times_q}\times{\mathbf{F}^\times_q}\times{\mathbf{F}_q}$ for which $m_2/m_1\not\in S_\mathcal{F}$ one has
$$\mathcal{C}(\widehat\mathcal{F},\gamma)\ll_{C(\mathcal{F})} q^{-1/2}.$$

Returning to \eqref{eqfirstCS}, we bound trivially (by \eqref{eqdiagbound}) the contribution of the $O_\mathcal{F}(M)$ $(m_1,m_2)$ such that the ratio $m_2/m_1\mods q$ is in $S_\mathcal{F}$. For the other terms, we may use the P\'olya-Vinogradov method  and bound these terms by
$$\ll_{C(\mathcal{F})}\|\alpha_M\|_2^2\|\beta_N\|_2^2Mq^{1/2}\log q.$$
Combining these bounds leads to the final result.
\qed

\section{Trace functions vs.~modular forms}\label{sectracemodular}
In this section we discuss the proof of Theorem \ref{cortypeI1/2}. This theorem is a special case of the resolution of another problem: the question of the correlation between trace functions and the Fourier coefficients $(\rho_f(n))_{n}$ of some modular Hecke eigenform (cf.~\cite[Chap. 14\&15]{IwKo} and references herein for a quick introduction to the theory modular forms). Given some trace function, we  consider the correlation sum
$$\mathcal{S}(K,f;X):=\sum_{n\leq X}\rho_f(n)K(n)$$ or its smoothed version
$$\mathcal{S}_V(K,f;X):=\sum_{n}\rho_f(n)K(n)V(\frac{n}X).$$
These sums are bounded (using the Rankin-Selberg method) by
$$O_{C(\mathcal{F}),f}(X\log^{3} X).$$
It turns out that the problem of bounding $\mathcal{S}(K,f;X)$ and $\mathcal{S}_V(K,f;X)$ non-trivially is most interesting when $N$ is of size $q$ or smaller.

In this section, we sketch the proof of the following
\begin{theorem}[Trace function vs.~modular forms, \cite{FKM1}]\label{thmKmodular} Let $\mathcal{F}$ be an irreducible Fourier sheaf of weight $0$ and $K$ its associated trace function. Let $(\rho_f(n))_{n\geq 1}$ be the sequence of Fourier coefficients of some modular form $f$ with trivial nebentypus and $V\in C^\infty_c(\mathbf{R}_{>0})$. For $X\geq 1$ and any $\eta<1/8$, we have
$$\mathcal{S}(K,f;X)\ll X(1+\frac{q}X)^{1/2}q^{-\eta/2},$$
and
$$\mathcal{S}_V(K,f;X)\ll X(1+\frac{q}X)^{1/2}q^{-\eta}.$$
The implicit constants depend only on $\eta$, $f$,
$C(\mathcal{F})$ and $V$. Moreover, the dependency on $C(\mathcal{F})$ is
at most polynomial.
\end{theorem}

 This result shows the absence of correlation when $X\gg q^{1-1/8}$.
 The proof, which uses the amplification method and the Petersson-Kuznetzov trace formula, will ultimately be a consequence of Theorem \ref{thmautogroup}.

We give below an idea of the proof. To simplify matters, we will assume that $X=q$ and we wish to bound non-trivially the sum
\begin{equation}\label{SVdefnoq}
\mathcal{S}_V(K,f):=\sum_{n\geq 1}\rho_f(n)K(n)V(\frac{n}q)
\end{equation}
for $V$ a fixed smooth function. Moreover, to simplify things further, we will assume that $f$ has level $1$ and is cuspidal and holomorphic of very large (but fixed) weight.

\subsection{Trace functions vs.~the divisor function}
An important special case of Theorem \ref{thmKmodular} is when $f$ is an Eisenstein series, for instance when
$$f(z)=\frac{\partial}{\partial s}E(z,s)_{|s=1/2}\hbox{ for }E(z,s)=\frac{1}2\sum_{(c,d)=1}\frac{y^s}{|cz+d|^{2s}}$$
is the non-holomorphic Eisenstein series at the central point. In that case we have
$$\rho_f(n)=d(n)$$ the divisor function, and so one has
\begin{equation}\label{eqbounddiv}
\sum_{m,n\geq 1}K(mn)V(\frac{mn}X)\ll_{V,C(\mathcal{F})} X(1+\frac{q}X)^{1/2}q^{-\eta}
\end{equation}
whenever $K$ is the trace function of a Fourier sheaf. This bound holds similarly for the unitary Eisenstein series $E(z,s)$ at any $s=\frac12+it$, where the divisor function is replaced by
$$d_{it}(n)=\sum_{ab= n}(a/b)^{it}.$$
Such general bounds make it possible to separate the variables $m,n$ in \eqref{eqbounddiv} and eventually to prove Theorem \ref{cortypeI1/2}.

\begin{remark} As we will see below, the proof of Theorem \ref{thmKmodular} is not a "modular form by modular form" analysis; instead the proof is global, involving the full automorphic spectrum, and establishes the required bound "for all modular forms $f$ at once", including Eisenstein series and therefore proving Theorem \ref{cortypeI1/2} on the way.
\end{remark}

\subsection{Functional equations}
Our first objective is to understand why the range $X=q$ is interesting. This come from the functional equations satisfied by modular forms as a consequence of their automorphic properties. These equations present themselves in various shapes. One is the Voronoi summation formula, which in its
simplest form is the following:
\begin{proposition}[Voronoi summation formula]\label{Voronoi} Let $f$ be a holomorphic modular form of weight $k$ and level $1$ with Fourier coefficients $(\rho_f(n))_n$. Let $V$ be a smooth compactly supported function, $q\geq 1$ and $(a,q)=1$. We have
  for $X>0$
$$
\sum_{n\geq 1} \rho_f(n)V\Bigl(\frac{n}X\Bigr)e\Bigl(\frac{an}{q}\Bigr) =
\varepsilon(f)\frac{X}{q} \sum_{n\geq
  1}\rho_f(n)e\Bigl(-\frac{\overline{a}n}{q}\Bigr)
  \widetilde V\Bigl(\frac{Xn}{q^2}\Bigr)
$$
where $\varepsilon(f)=\pm 1$ denotes the sign of the functional equation of $L(f,s)$, and
$$\widetilde V(y)=\int_{0}^\infty V(u)\mathcal{J}_k(4\pi\sqrt{ uy})du,$$
with
\begin{equation*
  \mathcal{J}_k(u)  =
  2\pi i^kJ_{k-1}(u),
  \end{equation*}
  where $$J_{k-1}(x)=\sum_{l=0}^\infty\frac{(-1)^l}{l !(l+k-1) !}(\frac{x}{2})^{2l+k-1}$$
is the Bessel function of order $k-1$.
\end{proposition}
There are several possible proofs of this proposition: one can proceed classically from the Fourier expansion of the modular form $f$ using automorphy relations (see \cite[Theorem A.4]{KMVDMJ}). Another more conceptual approach is to use the Whittaker model of the underlying automorphic representation; this approach extends naturally to higher rank automorphic forms (see \cite{IT}). One could also point out other related works like \cite{MilSch} as well as the recent paper \cite{KirZhou}.
We can extend this formula to general functions modulo $q$. Given $K\colon \mathbf{Z}\rightarrow\mathbf{C}$ a $q$-periodic function, we define its \emph{Voronoi transform} $\bessel{K}$ of $K$ as
$$
\bessel{K}(n) = \frac{1}{\sqrt{q}}\sum_{\substack{h\bmod q\\(h,q) =1}}
\fourier{K}(h) \mathrm{e}_q ({\overline h n} )=\frac{1}{\sqrt{q}}\sum_{\substack{h\bmod q\\(h,q) =1}}
\fourier{K}(h^{-1}) \mathrm{e}_q ({h n} ).
$$
Combining the above formula with the Fourier decomposition
$$K(n)=\frac{1}{q^{1/2}}\sum_{a\mods q}\widehat K(a)\mathrm{e}_q(-an),$$
we get
\begin{corollary}\label{corvoronoi} Notations are above, given $K$ a $q$-periodic arithmetic function, we have  for $X>0$
\begin{eqnarray*}
\sum_{n\geq 1}\rho_f(n)K(n)V\Bigl(\frac nX\Bigr)&=& \frac{\widehat K(0)}{q^{1/2}}\sum_{n\geq 1} \rho_f(n)V\Bigl(\frac nX\Bigr)+\\
&&\ \varepsilon(f)\frac{X}{q} \sum_{n\geq
  1}\rho_f(n)\widecheck K(- n)\widetilde V\Bigl(\frac{nX}{q^2}\Bigr).
\end{eqnarray*}

\end{corollary}
\begin{remark} Another way to obtain such result is to consider the Mellin transform of (the restriction to ${\mathbf{F}^\times_q}$ of) $K$:
$$\tilde K(\chi)=\frac{1}{(q-1)^{1/2}}\sum_{x\in{\mathbf{F}^\times_q}}K(x)\chi(x)$$
so that for $x\in{\mathbf{F}^\times_q}$
$$K(x)=\frac{1}{(q-1)^{1/2}}\sum_{\chi}\tilde K(\chi)\chi^{-1}(x).$$
One can then use the (archimedean) inverse-Mellin transform and the functional equation satisfied by the Hecke $L$-function
$$L(f\otimes\chi,s)=\sum_{n\geq 1}\frac{\rho_f(n)\chi(n)}{n^{s}}$$
to obtain the formula. For this, one observes that the Mellin transform of $\widecheck{K}_{|{\mathbf{F}^\times_q}}$ is proportional to
$$\chi\mapsto \varepsilon(\chi)\tilde K(\chi^{-1})$$
where $\varepsilon(\chi)$ is the normalized Gauss sum. This method extends easily to automorphic forms of higher rank but uses the fact that $q$ is prime (so that ${\mathbf{F}^\times_q}$ is not much smaller that ${\mathbf{F}_q}$).
\end{remark}
The identity of Corollary \ref{corvoronoi} is formal and has nothing to do whether $K$ is a trace function or not. In particular applying it to the Dirac function $\delta_a(n)=\delta_{n\equiv a\mods q}$, for some $a\in{\mathbf{F}^\times_q}$ we obtain
$$\widehat{\delta_a}(h)=\frac{1}q^{1/2} \mathrm{e}_q(ah),\ \widecheck \delta_a(n)=\frac{1}{q^{1/2}}\Kl_2(an;q)$$
so that
\begin{eqnarray}\label{eqdeltacase}
q^{1/2}\sum_{n\equiv a\mods q}\rho_f(n)V\Bigl(\frac nX\Bigr)&=& \frac{1}{q^{1/2}}\sum_{n\geq 1} \rho_f(n)V\Bigl(\frac nX\Bigr)+\\
&&\ \varepsilon(f)\frac{X}{q} \sum_{n\geq
  1}\rho_f(n)\Kl_2(-an;q)\widetilde V\Bigl(\frac{nX}{q^2}\Bigr). 	\nonumber
\end{eqnarray}
This is an example of a natural transformation which, starting from the elementary function $\delta_a$ produces a genuine trace function ($\Kl_2$).

Besides this case we would like to use the formula for $K$ a trace function. We observe that the Voronoi transform $\widecheck K$ is "essentially" the Fourier transform of the function $$h\in{\mathbf{F}^\times_q}\mapsto \widehat K(h^{-1})=\widehat K(w\cdot h)$$ with $w=\begin{pmatrix}0&1\\1&0
\end{pmatrix}$; it is therefore essentially involutive. It would be useful to know that $\widecheck K$ is a trace function. Suppose that $K$ is associated to some isotypic Fourier sheaf $\mathcal{F}$, then $\widecheck K$ is a (isotypic) trace function as long as  $w^*\widehat\mathcal{F}$ is a Fourier sheaf. This means that $\widehat\mathcal{F}$ has no irreducible constituent of the shape $w^*\mathcal{L}_\psi$ which (by involutivity of the Fourier transform means that $\mathcal{F}$ has no irreducible constituent isomorphic to some Kloosterman sheaf $\mathcal{K}\ell_2$. This reasoning\footnote{by involutivity of the Voronoi transform} is essentially the reverse of the one leading to \eqref{eqdeltacase}.

Let us assume that $\widecheck K$ is also a trace function. Then, integration by parts show that for $V$ smooth and compactly supported, $\widetilde V(x)$ has rapid decay for $x\gg 1$.  Hence Corollary \ref{corvoronoi} is an equality between a sum of length $X$ and a sum of length about $q^2/X$ (up to the term $\frac{\widehat K(0)}{q^{1/2}}\sum_{n\geq 1} \rho_f(n)V\Bigl(\frac nX\Bigr)$ which is easy to understand). The two lengths are the same when $X=q$.

\subsection{The amplification method}

As mentioned above Theorem \ref{thmKmodular} is proven "for all modular forms at one" as a consequence of the amplification method.

The principle of the amplification method (invented by H. Iwaniec and which  in the special case $K=\chi$ was used first by Bykovskii) consist, in  the following. For $L\geq 1$ and $(x_l)_{l\leq L}$ real numbers we consider the following average over orthogonal bases of modular forms (holomorphic or general) of level $q$:
\begin{equation}\label{momentholk}
M_k(K ):=\sum_{g\in\mathcal{B}_k(q)}|A(g )|^2|\mathcal{S}_V(g,K)|^2
\end{equation}
(cf.~\eqref{SVdefnoq} for the definition of $\mathcal{S}_V(g,K)$) and
\begin{multline}\label{momentdef}
M(K ):=\sum_{k \equiv 0 \mods{2},\ k>0} \dot{\phi}(k)(k-1)
\sum_{g\in\mathcal{B}_k(q)}|A(g )|^2|\mathcal{S}_V(g,K)|^2
  \\
  + \sum_{g\in\mathcal{B}(q)} \tilde{\phi}(t_g)\frac{4 \pi }{\cosh(\pi
    t_g)}|A(g )|^2|\mathcal{S}_V(g,K)|^2\\
  + \,\sum_{g\in
    \mathcal{B}_E(q)}\int_{-\infty}^{\infty}\tilde{\phi}(t)\frac{1}{\cosh(\pi
    t)} |A(g,t)|^2|\mathcal{S}_V(E_{g}(t),K)|^2\,dt,
\end{multline}
where $\mathcal{B}_{k}(q),\ \mathcal{B}(q),\ \mathcal{B}_E(q)$ denote orthonormal bases of Hecke eigenforms of level $q$ (either holomorphic of weight $k$ or Maass or Eisenstein series), $\dot{\phi},\ \tilde{\phi}$ are  weights constructed from some smooth function, $\phi$, rapidly decreasing at $0$ and $\infty$,  which depend only on the spectral parameters of the forms and for each form $g$, $A(g )$ ("A" is for amplifier) is the linear form in the Hecke eigenvalues $(\lambda_g(n))_{(n,q)=1}$ given by
$$A(g )=\sum_{l\leq L}x_l\lambda_g(l).$$

The weights $\tilde{\phi}$ are positive while the weight $\dot{\phi}(k)$ is positive at least for $k$ large enough; one can then add to this quantity a finite linear combination of the $M_k(K),\ k\ll 1$ from which one can bound
\begin{multline}\label{momentdef2}
|M|(K ):=\sum_{k \equiv 0 \mods{2},\ k>0} |\dot{\phi}(k)|(k-1)
\sum_{g\in\mathcal{B}_k(q)}|A(g )|^2|\mathcal{S}_V(g,K)|^2
  \\
  + \sum_{g\in\mathcal{B}(q)} \tilde{\phi}(t_g)\frac{4 \pi }{\cosh(\pi
    t_g)}|A(g )|^2|\mathcal{S}_V(g,K)|^2\\
  + \,\sumsum_{g\in
    \mathcal{B}_E(q)}\int_{-\infty}^{\infty}\tilde{\phi}(t)\frac{1}{\cosh(\pi
    t)} |A(g,t)|^2|\mathcal{S}_V(E_{g}(t),K)|^2\,dt.
\end{multline}
As we explain below one will be able to prove the following bound
\begin{equation}\label{Mbound}
M(K ), M_{k}(K )\ll_{C(\mathcal{F})} q^{o(1)}(q\sum_{l\leq L}|x_l|^2+q^{1/2}L(\sum_{l\leq L}|x_l|)^2).
\end{equation}
Now if $f$ is a Hecke-eigenform of level $1$ (of $L^2$ norm $1$ for the usual inner product on the level one modular curve) then $f/(q+1)^{1/2}$ embeds in an orthonormal basis of forms of level $q$.

Since all the terms in $|M|(K )$ are non-negative, this sums bounds any of its terms occurring discretely  (i.e.~when $f$ is a cusp form). Therefore we obtain
$$\frac{1}{q+1}|A(f )|^2|\mathcal{S}_V(f,K)|^2\ll_{C(\mathcal{F}),f} q^{o(1)}(q\sum_{l\leq L}|x_l|^2+q^{1/2}L(\sum_{l\leq L}|x_l|)^2).$$
Now we perform amplification by choosing some  bounded sequence $(x_l)_{l\leq L}$ tailor made for $f$ such that $A(f)$ is "large".
Specifically, choosing
$$x_l=\mathrm{sign}(\lambda_f(l)),$$
we obtain
$$|A(f)|\gg L^{1+o(1)}.$$
Dividing by $L$ we obtain
$$|\mathcal{S}_V(f,K)|^2\ll q^{o(1)}(q^2/L+q^{3/2}L^2)$$
and the optimal choice is $L=q^{1/6}$ giving us
$$\mathcal{S}_V(f,K)\ll q^{1-1/12+o(1)}.$$

\subsection{Computing the moments}
We now bound $M(K)$. Opening squares and using the multiplicative properties of Hecke eigenvalues, we are essentially reduced to bounding sums of the shape
\begin{equation}\label{eqmodelsummodular}
\sumsum_{m,n}V(\frac{m}q)V(\frac{n}q)K(m)\ov{K(n)}\Delta_{q,\phi}(lm,n)
\end{equation}
and
\begin{equation}\label{eqmodelsummodular}
\sumsum_{m,n}V(\frac{m}q)V(\frac{n}q)K(m)\ov{K(n)}\Delta_{q,k}(lm,n)
\end{equation}
where $1\leq l\leq L^2$,
$$\Delta_{q,k}(lm,n)=\sum_{g\in\mathcal{B}_k(q)}\rho_g(lm)\ov{\rho_g(n)}$$
and
\begin{eqnarray*}\label{moment2}
\Delta_{q,\phi}(lm,n)&&=\sum_{k \equiv 0 \mods{2},\ k>0} \dot{\phi}(k)(k-1)
\sum_{g\in\mathcal{B}_k(q)}\rho_g(lm)\ov{\rho_g(n)} \\
&&\ \ \   + \sum_{g\in\mathcal{B}(q)} \tilde{\phi}(t_g)\frac{4 \pi }{\cosh(\pi
    t_g)}\rho_g(lm)\ov{\rho_g(n)}\\
  &&\ \ \ + \,\sum_{g\in
    \mathcal{B}_E(q)}\int_{-\infty}^{\infty}\tilde{\phi}(t)\frac{1}{\cosh(\pi
    t)} \rho_g(lm,t)\ov{\rho_g(n,t)}\,dt.
\end{eqnarray*}

The Petersson-Kuznetzov formula expresses $\Delta_{q,k}(m,n)$ $\Delta_{q,\phi}(m,n)$ as sums of Kloosterman sums:
\begin{equation}
\label{Pet}
\Delta_{q,k}(m,n)=\delta_{m=n}+2\pi i^{-k}\sum_{c} \frac{1}{cq}
S(m, n;cq)J_{k-1}\left(\frac{4\pi\sqrt{mn}}{cq}\right).
\end{equation}
and
\begin{equation}
\label{Kuz}
\Delta_{q,\phi}(m,n)=\sum_{c} \frac{1}{cq}
S(m, n;cq)\phi\left(\frac{4\pi\sqrt{mn}}{cq}\right),
\end{equation}
where
$$S(m, n;cq)=\sum_{(x,cq)=1}e\left(\frac{mx+n\ov x}{cq}\right)$$
is the non-normalized Kloosterman sum of modulus $cq$ (where $x.\ov x\equiv 1\mods{cq}$). In \eqref{eqmodelsummodular}, because $m$ and $n$ are of size $q$ and $\phi$ is rapidly decreasing at $0$, the contribution of the $c\gg l^{1/2}$ is small. We will simplify further by evaluating only the contribution of $c=1$, that is
$$\frac1q\sumsum_{m,n}V(\frac{m}q)V(\frac{n}q)K(m)\ov{K(n)}S(lm,n;q)\phi(\frac{4\pi\sqrt{lmn}}{q}).$$
Our next step is  to open the Kloosterman sum and apply the Poisson summation formula on the $m$ and $n$ variables. We obtain
$$\frac{1}q\frac{q^2}{(q^{1/2})^2}\sumsum_{m^*,n^*}\widehat{W}(m^*,n^*)\sum_{x\in{\mathbf{F}^\times_q}}\widehat K(lx+m^*)\ov{\widehat K(x^{-1}+n^*)}$$
where
$$W(x,y)=V(x)V(y)\phi(4\pi\sqrt{lxy}).$$
In particular, the Fourier transform $\widehat{W}(m^*,n^*)$ is very small unless $m^*+n^*\ll l$ so the above sum is over $m^*,n^*\ll l$.
Setting $$\gamma_1=\begin{pmatrix}l&m^*\\&1
\end{pmatrix},\ \gamma_2=\begin{pmatrix}n^*&1\\1&0
\end{pmatrix}
$$
we see that the $x$-sum is the correlation sum
$q\mathcal{C}(K,\gamma_2.\gamma_1^{-1})$ which is $\ll q^{1/2}$ if $\gamma_2.\gamma_1^{-1}$ does not belong to the group of automorphism of ${\widehat\mathcal{F}}$. Using Theorem \ref{thmautogroup} one show that if $l$ is a sufficiently small fixed (positive) power of $q$, the bound $$\sum_{x\in{\mathbf{F}^\times_q}}\widehat K(lx+m^*)\ov{\widehat K(x^{-1}+n^*)}\ll_{C(\mathcal{F})} q^{1/2}$$ holds for most pairs  $(m^*,n^*)$. From this we deduce \eqref{Mbound}.

\section{The ternary divisor function in  arithmetic progressions to large moduli}\label{Secternary}
Given some arithmetic function $\lambda=(\lambda(n))_{n\geq 1}$,  a natural question in analytic number theory is to understand how well $\lambda$ is distributed in arithmetic progressions: given $q\geq 1$ and $(a,q)=1$ one would like to evaluate the sum
$$\sum_\stacksum{n\leq X}{n\equiv a\mods q}\lambda(n)$$
as $X\rightarrow\infty$ and for $q$ as large as possible with respect to $X$. It is natural to evaluate the difference
$$E(\lambda;q,a):=\sum_\stacksum{n\leq X}{n\equiv a\mods q}\lambda(n)-\frac{1}{\varphi(q)}\sum_\stacksum{n\leq X}{(n,q)=1}\lambda(n)$$
and assuming that $\lambda$ is "essentially" bounded the target would be to obtain a bound of the shape
\begin{equation}\label{eqEbound}
E(\lambda;q,a)\ll_A \frac{X}q(\log X)^{-A}
\end{equation}
for any $A\geq 0$, as $X\rightarrow+\infty$ and for $q$ as large as possible compared to $X$.

The emblematic case is when $\lambda=1_\mathcal{P} $ is the characteristic function of the primes. In that case the problem can be approached through the analytic properties of Dirichlet $L$-functions and in particular the localization of their zeros. The method of Hadamard-de la Vallee-Poussin (adapted to this setting by Landau) and the Landau-Siegel theorem show that \eqref{eqEbound} is satisfied for $q\leq (\log X)^{B}$ for any given $B$, while the validity of the generalized Riemann hypothesis would give \eqref{eqEbound} for $q\ll X^{1/2-\delta}$ for any fixed $\delta>0$.  Considering averages over $q$, it is possible to reach the GRH range and this is the content of the Bombieri-Vinogradov theorem
\begin{theorem}[Bombieri-Vinogradov] For any $A\geq 0$ there exists $B=B(A)$ such that for $Q\leq X^{1/2}/\log^BX$
$$\sum_{q\leq Q}\mathop{\mathrm{Max}}\limits_{(a,q)=1}|E(1_\mathcal{P};q,a)|\ll X/\log^AX.$$
\end{theorem}
Passing the GRH/Bombieri-Vinogradov  range and reaching the inequality $Q\leq x^{1/2+\eta}$ for some $\eta>0$ is a fundamental problem in analytic number theory with many major applications. For instance, Y. Zhang's breakthrough on the existence of bounded gaps between primes proceeded by establishing a version of the Bombieri-Vinogradov theorem going beyond the $Q=X^{1/2}$ range on average over smooth moduli. \cite{YZhang}; we will discuss some of the techniques entering his proof below.

Several arithmetic functions are of interest besides the characteristic function of the primes or other sequences. One of the simplest are the divisor functions
$$d_k(n)=\sum_{n_1.\ldots n_k=n}1.$$
For $k=2$, Selberg and others established the following (still unsurpassed)
\begin{theorem} [The divisor function in  arithmetic progressions to large moduli]\label{thmd2} For every non-zero integer $a$, every $\varepsilon,A>0$, every $X\geq 2$ and  every prime $q$, coprime with $a$, satisfying $$q\leq X^{2/3-\varepsilon},$$ we have
$$
E(d_2;q,a)\ll \frac{X}{q}(\log X)^{-A},
$$
where the implied constant only depends on $\varepsilon$ and $A$ (and not on $a$).
\end{theorem}
\proof(Sketch)
To simplify matters we consider the problem of evaluating the model sum
$$\sum_{n_1n_2\equiv a\mods q}V(\frac{n_1}{N_1})V(\frac{n_2}{N_2})$$
for $N_1N_2=X$ and $V\in\mathcal{C}^\infty_c(]1,2[)$. We apply the Poisson summation formula to the $n_1$ variable and to the $n_2$ variable. The condition $n_1n_2\equiv a\mods q$ get transformed into
$$\delta_{n_1n_2\equiv a\mods q}\rightarrow q^{-1/2}\mathrm{e}_q(an_1/n_2)\rightarrow q^{-1/2}\Kl_2(an_1n_2;q).$$
The ranges the ranges $N_1,N_2$ are transformed into $$N_1^*=q/N_1,N_2^*=q/N_2$$ and the whole model sum is transformed into a sum of the shape
$$MT(a;q)+ET(a;q)$$
where $MT(a;q)$ is a main term which we will not specify (but is of the right order of magnitude), and $ET(a;q)$ is an error term of the shape
$$ET(a;q)=\frac{1}{q^{1/2}}\frac{N_1}{q^{1/2}}\frac{N_2}{q^{1/2}}\sum_{n_1,n_2}\Kl_2(an_1n_2;q)\tilde V(\frac{n_1}{N_1^*})\tilde V(\frac{n_2}{N_2^*})$$
where $\tilde V$ is a rapidly decreasing function. By Weil's bound for Kloosterman sums, the error term is bounded by $q^{1/2+\epsilon}$ which is smaller that $X(\log X)^{-A}/q$ as long as $X\leq q^{2/3-2\varepsilon}$.
\qed

\begin{remark}\label{remselberg} Improving the exponent $2/3$ is tantamount to detect cancellation in the sum of Kloosterman sums above. We have given such an improvment in \eqref{eqbounddiv}; unfortunately in the present case the range of the variable $n_1n_2$ is $N_1^*N_2^*=q^2/X\leq q^{1/2}$ which is too short with current technology. See however the \cite{FoIw} for an improvement beyond the $q=x^{2/3}$ limit on average over a family of moduli $q$ admitting a specific factorisation.
\end{remark}

We now show how to go beyond the Bombieri-Vinogradov range for the specific case of the ternary divisor function
$$d_3(n)=\sum_{n_1n_2n_3=n}1$$
(in fact in a stronger form because it is not even necessary to average over the modulus $q$ !). The very first result of that kind is due to Friedlander-Iwaniec \cite{FrIw} (with $\frac12+\eta=\frac12+\frac1{231}$) and was later improved by Heath-Brown (with $\frac12+\eta=\frac12+\frac1{81}$) \cite{HBActa}. When the modulus $q$ is prime, the best result to date is to be found in \cite{FKM3}:
\begin{theorem}[The ternary divisor function in  arithmetic progressions to large moduli]\label{thmd3} For every non-zero integer $a$, every $A>0$, every $X\geq 2$ and  every prime $q$, coprime with $a$, satisfying $$q\leq X^{\frac{1}2+\frac{1}{47}},$$ we have
$$
E(d_3;q,a)\ll \frac{X}{q}(\log X)^{-A},
$$
where the implied constant only depends on $A$ (and not on $a$).
\end{theorem}
\begin{remark} One may wonder why these higher order divisor functions are so interesting: one reason is that these problems can be considered as approximations for the case of the von Mangoldt function. Indeed, the Heath-Brown identity (Lemma \ref{lemHB}) expresses the von Mangoldt function as a linear combination of arithmetic functions involving higher divisor functions, therefore studying higher divisor functions in  arithmetic progressions  to large moduli will enable to progress on the von Mangoldt function.\footnote{This was formalised by Fouvry \cite{FouCrelle}.}

\end{remark}
\proof
We consider again a model sum of the shape
$$\sum_{n_1n_2n_3\equiv a\mods q}V(\frac{n_1}{N_1})V(\frac{n_2}{N_2})V(\frac{n_3}{N_3})$$
for $N_1N_2N_3=X$ and $V\in\mathcal{C}^\infty_c(]1,2[)$. We apply the Poisson summation formula to the variables $n_1$  $n_2$ and $n_3$. The condition $n_1n_2n_3\equiv a\mods q$ is this time transformed into the hyper-Kloosterman sum
$$\frac{1}{q^{1/2}}\Kl_3(an_1n_2n_3;q).$$
The model sum is transformed into a main term (of the correct order of magnitude) and an error term
$$ET_3(a;q)=\frac{1}{q^{1/2}}\frac{N_1}{q^{1/2}}\frac{N_2}{q^{1/2}}\frac{N_3}{q^{1/2}}\sum_{n_1,n_2,n_3}\Kl_2(an_1n_2n_3;q)\tilde V(\frac{n_1}{N_1^*})\tilde V(\frac{n_2}{N_2^*})\tilde V(\frac{n_3}{N_3^*})$$
with $$N_i^*=q/N_i,\ i=1,2,3.$$
The objective is to obtain a bound of the shape
\begin{equation}\label{d3goal}
\Sigma_3:=\sum_{n_1,n_2,n_3}\Kl_3(an_1n_2n_3;q)\tilde V(\frac{n_1}{N_1^*})\tilde V(\frac{n_2}{N_2^*})\tilde V(\frac{n_3}{N_3^*})\ll\frac{q}{\log^Aq}
\end{equation}
for  $X=q^{2-\eta}$ for some fixed $\eta>0$ (small), or equivalently for
$$N_1^*N_2^*N_3^*=q^{1+\eta}.$$
We will show that when $\eta=0$, \eqref{d3goal} holds with the stronger bound $\ll q^{1-\delta}$
for some $\delta>0$. A variation of this argument will show \eqref{d3goal} for some positive $\eta$. Write
$$N_i^*=q^{\nu_i},\ i=1,2,3,\ \nu_1+\nu_2+\nu_3=1;$$
we assume that
$$0\leq \nu_1\leq\nu_2\leq\nu_3.$$
Suppose that $\nu_3\geq 1/2+\delta$. Then the P\'olya-Vinogradov method, applied to the $n_3$ variable, leads to a bound of the shape
$$\Sigma_3\ll q^{1-\nu_3+1/2}\log q\ll q^{1-\delta}\log q.$$

Otherwise we have
$\nu_3\leq 1/2+\delta$. We assume now that $\nu_1\geq 2\delta$; then $\nu_1\leq 1/3$, so that grouping the variables $n_2n_3$ into a single variable $n$ of size $\geq q^{2/3}$ (weighted by a divisor like function) and applying Theorem \ref{thmbilinear}, we obtain the bound
$$\Sigma_3\ll  q^{1-\delta}\log^3 q.$$
We may therefore assume that
$$\nu_1\leq 2\delta,\ \nu_2+\nu_3\geq 1-2\delta.$$
The $n_2n_3$-sum is similar to the sum in \eqref{eqbounddiv} (for $K(n)=\Kl_3(an_1n;q)$) and indeed the same bound holds, so that for any $\varepsilon>0$, we have
$$\Sigma_3\ll_\varepsilon q^{\nu_1+\frac{\nu_2+\nu_3}{2}+\frac12-\frac18+\epsilon}\ll_\varepsilon q^{2\delta+1-\frac18+\epsilon}$$
which gives the required bounds if $\delta$ is chosen $<1/24$.
\qed

\section{The geometric monodromy group and Sato-Tate laws}

In this section we discuss an important invariant attached an $\ell$-adic sheaf: its geometric  monodromy group. This will be crucial in the next section to study more advanced sums of trace functions (multicorrelation sums). Another rather appealing outcome of this notion are the {\em Sato-Tate} type laws which describe the distribution of the set of values of trace functions as $q^n$ grows.

\subsection{Sato-Tate laws for elliptic curves}

The term "Sato-Tate law" comes from the celebrated {\em Sato-Tate Conjecture} for elliptic curves over $\mathbf{Q}$ which is now a theorem established in a series of papers principally by Clozel, Harris, Shepherd-Barron and Taylor \cite{CHT,HSBT,Tay,BGHT}. Let $E/\mathbf{Q}$ be an elliptic curve defined over $\mathbf{Q}$ with a model over $\mathbf{Z}$ --for instance given by the Weierstrass equation
$$E\colon zy^2=x^3-azx^2-bz^3,\ a,b\in\mathbf{Z},\ \Delta(a,b)=4a^3-27b^2\not=0.$$
For any prime $q$, we denote by $E({\mathbf{F}_q})$ the reduction modulo $q$ of $E$; we have (Hasse bound)
$$a_q(E):=q+1-|E({\mathbf{F}_q})|\in[-2q^{1/2},2q^{1/2}];$$
we can then define the angle $\theta_{E,q}\in [0,\pi]$ of $E$ at the prime $q$ by the formula
$$a_q(E)/q^{1/2}=2\cos(\theta_{E,q}).$$

\begin{theorem}[Sato-Tate law for an elliptic curve]\label{origST} Let $E/\mathbf{Q}$ be a non-CM elliptic curve. As $X\rightarrow\infty$, the multiset of angles
$\{\theta_{E,q},\ q\leq X,\ q\ prime\}$  becomes equidistributed  on $[0,\pi]$ with respect to the so-called Sato-Tate measure $\mu_{ST}$ whose density is given by $$d\mu_{ST}=\frac{2}\pi\sin^2(\theta)d\theta.$$
In other words, for any interval $I\subset[0,\pi]$, we have
$$\frac{|\{q\leq X,\ q\ prime,\ \theta_{E,q}\in I\}|}{\pi(X)}\rightarrow \mu_{ST}(I)=\frac{2}\pi\int_I\sin^2(\theta)d\theta$$
as $X\rightarrow\infty$.
\end{theorem}
The Sato-Tate measure $\mu_{ST}$ introduced in this statement has a more conceptual description: let $\SU_2(\mathbf{C})$ be the special unitary group in two variables and let $\SU_2(\mathbf{C})^\natural$ be its space of conjugacy classes, that space is identified with $[0,\pi]$ via the map
$$\begin{pmatrix}e^{i\theta}&0\\0&e^{-i\theta}
\end{pmatrix}^\natural \mapsto \theta\mods \pi.
$$
The Sato-Tate measure $\mu_{ST}$ then corresponds to the direct image of the Haar measure on $\SU_2(\mathbf{C})$ under the natural projection $\SU_2(\mathbf{C})\mapsto \SU_2(\mathbf{C})^\natural$: this follows from the Weyl integration formula. Now let us recall that attached to the elliptic curve $E$ is a Galois representation on its $\ell$-adic  Tate module\footnote{which is an $\ell$-adic sheaf over $\Spec(\mathbf{Z})$}
$$\rho_E\colon \Gal(\ov\mathbf{Q}/\mathbf{Q})\to \GL(V_\ell(E))$$
which is unramified at every prime $q$ not dividing the discriminant (of the integral model) of $E$ and for such a prime, the Frobenius conjugacy class satisfies
$$\tr(\Frob_q|V_\ell(E))=a_q(E)=2q^{1/2}\cos(\theta_{E,q})$$
hence defines a complex conjugacy class
$$\begin{pmatrix}e^{i\theta_{E,q}}&0\\0&e^{-i\theta_{E,q}}
\end{pmatrix}^\natural.$$
The Sato-Tate law for non-CM elliptic curves then states that this collection of Frobenius conjugacy classes becomes equidistributed relative to this measure.

\begin{remark} For CM-elliptic curves there is also a (different) Sato-Tate law which was established by Hecke much earlier: the angles $\theta_{E,q}$ are equidistributed with respect to the uniform measure.
\end{remark}

The proof of the Sato-Tate conjecture in the non-CM case is one of the crowning achievements of the Langlands program; several decades before its proof, several variants of this conjecture have been established for {\em families} of elliptic curves over finite fields: given $a,b\in{\mathbf{F}_q}$ such that $\Delta(a,b):=4a^3-27b^2\not=0$ the  Weierstrass equation
$$E_{a,b}\colon y^2=x^3-ax^2-b$$
defines an elliptic curve over ${\mathbf{F}_q}$ and let
$$a_q(a,b)=q+1-|E_{a,b}({\mathbf{F}_q})|=2q^{1/2}\cos(\theta_{a,b,q}).$$
Using the Selberg trace formula, Birch \cite{BirchST}, established the following variant of the Sato-Tate law for elliptic curves
\begin{theorem} As $q\rightarrow\infty$ the multiset of angles
$\{\theta_{a,b,q},\ (a,b)\in\mathbf{F}_q^2,\ \Delta(a,b)\not=0\}$   becomes equidistributed  on $[0,\pi]$ with respect to  $\mu_{ST}$:
for any interval $I\subset[0,\pi]$, we have
$$\frac{|\{(a,b)\in\mathbf{F}_q^2,\ \Delta(a,b)\not=0, \theta_{a,b,q}\in I\}|}{|\{(a,b)\in\mathbf{F}_q^2,\ \Delta(a,b)\not=0\}|}\rightarrow \mu_{ST}(I),\ q\rightarrow\infty.$$
\end{theorem}

There is another variant, spelled out by Katz and which is consequence of Deligne's work \cite{WeilII}; it concerns one parameter families of elliptic curves: let $a(T),b(T)\in\mathbf{Z}[T]$ be polynomials such that $\Delta(T):=4a(T)^3+27b(T)^2\not=0$; for $q$ a sufficiently large prime, the equation over ${\mathbf{F}_q}$,
$$E_t\colon y^2=x^3-a(t)x^2-b(t)$$
defines a family of elliptic curves indexed by the set $U({\mathbf{F}_q}):=\{t\in{\mathbf{F}_q},\ \Delta(t)\not=0\}.$
For any $t\in U({\mathbf{F}_q})$ we set $$\theta_{t,q}:=\theta_{a(t),b(t),q}\in[0,\pi].$$
\begin{theorem}\label{Ellequid} Assume that the $j$-invariant $j(T)=-1728\frac{4a(T)^3}{\Delta(T)}$ is not constant, then the multiset
$\{\theta_{t,q},\ t\in U({\mathbf{F}_q})\}$   becomes equidistributed  on $[0,\pi]$ with respect to  $\mu_{ST}$ as $q\rightarrow\infty$. In other words, for any interval $I\subset[0,\pi]$, we have
$$\frac{|\{t\in U(\mathbf{F}_q),\ \theta_{t,q}\in I\}|}{|U({\mathbf{F}_q})|}\rightarrow \mu_{ST}(I),\ q\rightarrow\infty.$$
\end{theorem}
\begin{remark} Deligne \cite[Proposition 3.5.7]{WeilII} proved another variant of the Sato-Tate law  when the parameter set is $U({\mathbf{F}_{q^n}})$ with $q$ fixed (large enough) and $n\rightarrow\infty$; this is in fact a special case of "Deligne's equidistribution theorem" \cite[Theorem 3.5.3]{WeilII}
\end{remark}

Theorem \ref{Ellequid} is a special case of very general Sato-Tate laws for $\ell$-adic sheaves: indeed the function
$$t\in U({\mathbf{F}_q})\mapsto \frac{a_q(t)}{q^{1/2}}$$
is the trace function of some geometrically irreducible $\ell$-adic sheaf $\mathcal{E}_{a,b}$ whose associated trace function is given by
\begin{equation}\label{ellsheaf}
t\mapsto -\frac{1}{q^{1/2}}\sum_{x\in{\mathbf{F}_q}}(\frac{x^3+a(t)x+b(t)}q),
\end{equation}
 where $\left(\frac{\cdot}{q}\right)$ is the Legendre symbol. A key player for such Sato-Tate law is the

\subsection{The geometric monodromy group of a sheaf}

\begin{definition}[\cite{GKM}{ Chap. 3}] Let $\mathcal{F}$ be a sheaf pure of weight $0$ and let $\rho_\mathcal{F}$ be the associated Galois representation. The geometric (resp.~arithmetic) monodromy group $G_{\mathcal{F},\mathrm{geom}}$ (resp.~$G_{\mathcal{F},\mathrm{arith}}$) is the Zariski closure of $\rho_\mathcal{F}(G^{\mathrm{geom}})$ (resp.~$\rho_\mathcal{F}(G^{\mathrm{arith}})$) inside $\GL(V_\mathcal{F})$; in particular $$G_{\mathcal{F},\mathrm{geom}}\subsetG_{\mathcal{F},\mathrm{arith}}.$$ It follows from \cite[Th\'eor\`eme (3.4.1)]{WeilII} that the connected component  $G_{\mathcal{F},\mathrm{geom}}^0$ of $G_{\mathcal{F},\mathrm{geom}}$ is semisimple.
\end{definition}
\begin{example}
\begin{itemize}
\item In the case of the trace function \eqref{ellsheaf}, Deligne  showed \cite[Lemme 3.5.5]{WeilII}, that if $q>2$ and the $j$-invariant $j(T)\mods q$ is not constant, one has
$$\Ggeomd{\mathcal{E}_{a,b}}=\Garithd{\mathcal{E}_{a,b}}=\SL_2.$$
\item In his numerous books \cite{GKM,ESDE,Katzbull,MMP,TLM,KatzConvol} Katz computed the monodromy groups of various classes of sheaves: for instance, he proved in \cite[Theorem 11.1]{GKM} that for Kloosterman sheaves one has (for $q>2$)
$$\Ggeomd{\mathcal{K}\ell_k}=\Garithd{\mathcal{K}\ell_k}=\begin{cases}\SL_k&\hbox{ if $k$ is odd}\\ \Sp_{k}&\hbox{ if $k$ is even}.
\end{cases}
$$

\end{itemize}

\end{example}

\subsection{Sato-Tate laws}\label{secSTlaw}

In the sequel we make the simplifying hypothesis that
\begin{equation}\label{eqGarithincluded} \Ggeomd{\mathcal{F}}=\Garithd{\mathcal{F}}.
\end{equation}

\subsubsection{Moments of trace functions}

Before presenting the Sato-Tate laws in general, let us consider the very specific concrete problem of evaluating the {\em moments} of a trace function $K$. For $l\geq 0$ an integer, the $2l$-th moment of $K$ is the average
$$\mathcal{M}_{2l}(K)=\frac{1}{q}\sum_{x\in{\mathbf{F}_q}}|K(x)|^{2l}.$$
The possibility of evaluating these comes from the fact that $x\mapsto |K(x)|^{2l}$ is indeed a trace function (not necessarily and in fact almost never irreducible). Indeed let $\mathrm{Std}\colon \Ggeomd{\mathcal{F}}\hookrightarrow \GL(V_\mathcal{F})$ be the standard representation of the group $\Ggeomd{\mathcal{F}}$ and let
 $\rho_{l,l}$ be the representation $$\rho_{l,l}=(\mathrm{Std}\otimes \mathrm{Std}^{*})^{\otimes l}.$$
 Because of our assumption \eqref{eqGarithincluded} , the composition $$\rho_{l,l}(\mathcal{F})"="\rho_{l,l}\circ\rho_\mathcal{F}$$ is a representation of $\Garithd{\mathcal{F}}$ hence defines an $\ell$-adic sheaf pure of weight $0$ whose trace function is\footnote{at least at the $x$ where it is lisse}
  $x\mapsto |K(x)|^{2l}.$

 The decomposition of this representation into irreducible representations of $\Ggeomd{\mathcal{F}}$
$$\rho_{l,l}=m_1(\rho_{l,l}).1\oplus\bigoplus_{1\not=r\in\mathrm{Irr}(\Ggeomd{\mathcal{F}})}m_r(\rho_{l,l}).r$$
yields a decomposition of $\rho_{l,l}(\mathcal{F})$ into a sum of geometrically irreducible sheaves
$$\rho_{l,l}\circ \mathcal{F}=m_1(\rho_{l,l})\ov{\mathbf{Q}_{\ell}}\oplus\bigoplus_{1\not=r\in\mathrm{Irr}(\Ggeomd{\mathcal{F}})}m_r(\rho_{l,l})r\circ \mathcal{F}$$ and a decomposition of
$|K(x)|^{2l}$ as a sum of trace functions
$$|K(x)|^{2l}=m_1(\rho_{l,l})+\sum_{1\not=r}m_r(\rho_{l,l})K_{r\circ\mathcal{F}}(x).$$
From Deligne's Theorem (Cor. \ref{delignecor}) one deduce that
$$\frac{1}{q}\sum_{x}|K(x)|^{2l}=m_1(\rho_{l,l})+O_{C(\mathcal{F}),l}(q^{-1/2})$$
where $m_1(\rho_{l,l})$ is the multiplicity of the trivial representation
 in the representation $(\mathrm{Std}\otimes \mathrm{Std}^{*})^{\otimes l}$ of $\Ggeomd{\mathcal{F}}$. In the same way, we could evaluate (in terms of the representation theory of the group $\Ggeomd{\mathcal{F}}$) more general moments like
$$ \frac{1}{q}\sum_{x\in{\mathbf{F}_q}}|K(x)|^{2l}K(x)^{l'}$$
for integers $l,l'\geq 0$.

\subsubsection{Equidistribution of Frobenius conjugacy classes}

There is a more conceptual interpretation of these moments. For any $x\in U({\mathbf{F}_q})$, the Frobenius at $x$  acting on $V_\mathcal{F}$ produces a $\rho_\mathcal{F}(G^{\mathrm{arith}})$-conjugacy class $$\rho_\mathcal{F}(\Frob_x)\subset\Garithd{\mathcal{F}}(\mathbf{C})=G_{\mathcal{F},\mathrm{geom}}(\mathbf{C}).$$ The {\em Frobenius conjugacy class} of $\mathcal{F}$ at $x$ is by definition the $G_{\mathcal{F},\mathrm{geom}}(\mathbf{C})$-conjugacy class of its semisimple part (in the sense of Jordan decomposition) and is denoted $\theta_{x,\mathcal{F}}.$
 Let $K$ be any maximal compact subgroup of $\Ggeomd{\mathcal{F}}(\mathbf{C})$ and $K^\natural$ its space of conjugacy classes. As explained in \cite{GKM}(Chap. 3), the conjugacy class
$\theta_{x,\mathcal{F}}$ defines a unique conjugacy class in $K$, also denoted $\theta_{x,\mathcal{F}}\in K^\natural$.
 The Sato-tate laws describe the distribution of the set
$\{\theta_{x,\mathcal{F}},\ x\in U({\mathbf{F}_q})\}\hbox{ inside $K^\natural$}$ as $q\rightarrow\infty$.

More precisely, let $G$ be a connected semisimple algebraic group over ${\ov{\mathbf{Q}_{\ell}}}$ and $K\subset G(\mathbf{C})$ a maximal compact subgroup. Let $\mu^\natural$ be the direct image of the Haar probability measure on $K$ under the projection $K\mapsto K^\natural$.

\begin{theorem}[Sato-Tate law] Let $G$ and $K\subset G(\mathbf{C})$ as above. Suppose we are given a sequence of primes $q\rightarrow\infty$ and for each such prime some $\ell$-adic sheaf $\mathcal{F}$ over ${\mathbf{F}_q}$, satisfying \eqref{eqGarithincluded},  whose conductor $C(\mathcal{F})$ is bounded independently of $q$, such that $$\Ggeomd{\mathcal{F}}=G_{\mathcal{F},\mathrm{arith}} =G.$$
For any such $q$ and $x\in U({\mathbf{F}_q})$ let $\theta_{x,\mathcal{F}}\in K^\natural$ be the conjugacy class of $\mathcal{F}$ at $x$ relative to $K$.

	As $q\rightarrow\infty$ the sets of conjugacy classes
	$$\{\theta_{x,\mathcal{F}},\ x\in U({\mathbf{F}_q})\}$$ become equidistributed with respect to the  measure $\mu^\natural$:
the probability measure
	$$\frac{1}{|U({\mathbf{F}_q})|}\sum_{x\in U({\mathbf{F}_q})}\delta_{\theta_{x,\mathcal{F}}}$$
	 converges weakly to $\mu^\natural$.	 In other words, for any $f\in\mathcal{C}(K^\natural)$
\begin{equation}\label{eqequid}
\frac{1}{|U({\mathbf{F}_q})|}\sum_{x\in{\mathbf{F}_q}}f(\theta_{x,\mathcal{F}})\rightarrow \int_{K^\natural}f(\theta)d\mu^\natural(\theta),\ q\rightarrow\infty.
\end{equation}

\end{theorem}

\proof By the Peter-Weyl theorem, the functions
$$\tr(r)\colon \theta\in K^\natural\to \tr(r(\theta))\in\mathbf{C}$$
when $r$ ranges over all the irreducible representations of $G$, form an orthonormal basis of $L^2(K^\natural,\mu^\natural)$ and generates a dense subspace of the space of continuous functions on $K^\natural$. By Weyl equidistribution criterion it is therefore sufficient to show that for any $r$ irreducible and non-trivial, one has
$$\frac{1}{|U({\mathbf{F}_q})|}\sum_{x\in U({\mathbf{F}_q})}\tr(r(\theta_{x,\mathcal{F}}))\rightarrow \mu^\natural(\tr(r))=0.$$
The function
$$K_{r,\mathcal{F}}\colon x\in U({\mathbf{F}_q})\to r(\theta_{x,\mathcal{F}})$$ is the trace function associated to the sheaf $r\circ\mathcal{F}$ corresponding to the representation of $G_{\mathcal{F},\mathrm{arith}}$, $r\circ\rho_{\mathcal{F}}$ (because of \eqref{eqGarithincluded} this composition is well defined). That sheaf is by construction geometrically irreducible, non-trivial and its conductor is bounded in terms of $C(\mathcal{F})$ and $r$ only, so it follows from Deligne's Theorem that
$$\frac{1}{|U({\mathbf{F}_q})|}\sum_{x\in U({\mathbf{F}_q})}\tr(r(\theta_{x,\mathcal{F}}))\ll_{C(\mathcal{F}),r}q^{-1/2}\rightarrow 0.$$
\qed

\subsubsection{The case of Kloosterman sums} As we have seen above, for the Kloosterman sums $\Kl_2(x;q)$, we have
$$G=\Sp_2=\SL_2,\  K=\mathrm{SU}_2(\mathbf{C})$$ and, via the identification $K^\natural\simeq[0,\pi]$,  the  measure $\mu^{\natural}$ is identified with the { Sato-Tate} measure $\mu_{ST}$.

For $x\in{\mathbf{F}^\times_q}$, we define the angle $\theta_{q,x}\in [0,\pi]$ of the Kloosterman sum $\Kl_2(x;q)$ as
$$\Kl_2(x;q)=\tr\begin{pmatrix}e^{i\theta_{q,x}}&0\\0&e^{-i\theta_{q,x}}
\end{pmatrix}=2\cos(\theta_{q,x}).
$$

The Sato-Tate law becomes the following explicit statement (due to Katz):
\begin{theorem}[Sato-Tate law for Kloosterman sums] For any interval $I\subset[0,\pi]$
$$\frac{1}{q-1}|\{x\in{\mathbf{F}^\times_q},\ \theta_{q,x}\in I\}|\rightarrow \frac{2}\pi\int_I\sin^2(\theta)d\theta,\ q\rightarrow\infty.$$
\end{theorem}
The above Sato-Tate law is called "vertical" as it describes  the distribution of Kloosterman sums with varying parameters $x\in{\mathbf{F}^\times_q}$ as $q\rightarrow\infty$; such law is analogous to the Sato-Tate law of Theorem \ref{Ellequid}.

In \cite{Sommes}, Katz in analogy with the original Sato-Tate conjecture (Theorem \ref{origST})  asked for the distribution of the Kloosterman sums for a fixed value of the parameter (say $x=1$) and for  a varying prime modulus $q$. Katz made the following
\begin{conjecture}[Horizontal Sato-Tate law for Kloosterman sums]\label{katzconj} As $X\rightarrow\infty$, the multiset of Kloosterman angles
$\{\theta_{q,1},\ q\leq X,\ prime\}$  becomes equidistributed with respect to the Sato-Tate measure:
for any $[a,b]\subset[0,\pi]$, we have
$$\frac{1}{\pi(X)}|\{q\leq X,\ q\ prime,\ \theta_{q,1}\in[a,b]\}|\rightarrow \frac{2}\pi\int_a^b\sin^2(\theta)d\theta$$
as $X\rightarrow\infty$.
\end{conjecture}

\begin{remark} There are other variants of this vertical equidistribution conjecture that have been established recently:

\begin{itemize}
\item 	Heath-Brown and Patterson \cite{HBPatt} have proven that the angles of cubic Gauss sums of varying prime moduli are equidistributed with respect to the uniform measure.
\item Even closer to the current discussion, Duke, Friedlander and Iwaniec \cite{DFISalie} have proven the vertical equidistribution of the angles $\theta^S_{q,1}$ of {\em Sali\'e} sums defined by
$$S(1;q):=\frac{1}{q^{1/2}}\sum_\stacksum{x,y\in{\mathbf{F}^\times_q}}{xy=1}(\frac{x}{q})e\left(\frac{x+y}{q}\right)=:2\cos(\theta^S_{q,1})$$
again with respect to the uniform measure.
\end{itemize}
 \end{remark}

\subsection{Towards the horizontal Sato-Tate conjecture for almost prime moduli}

Unlike the original Sato-Tate conjecture the prospect for a proof of Conjecture \ref{katzconj} seem very distant at the moment.
Even the following very basic consequences of this conjecture seem today completely out of reach:
\begin{itemize}
\item There exist infinitely many primes $q$ such that $|\Kl_2(1;q)|\geq 2017^{-2017}$,
\item There exist infinitely many primes $q$ such that $\Kl_2(1;q)>0$ (resp.~$\Kl_2(1;q)<0$)
\end{itemize}
In this section we will explain how some of the results discussed so far enable to say something non-trivial as the cost of replacing the prime moduli $q$ by {\em almost prime} moduli (that is squarefree-integers with an absolutely bounded number of prime factors).

Recall that for $c\geq 1$ a squarefree integer and $(a,c)=1$ the normalized Kloosterman sum of modulus $c$ and parameter $a$ is
$$\Kl_2(a;c)=\frac{1}{c^{1/2}}\sum_{x\in(\mathbf{Z}/c\mathbf{Z})^\times}e\left(\frac{\ov x+ax}c\right).$$
By the Chinese remainder theorem, Kloosterman sums satisfy the {\em twisted multiplicativity} relation: for $c=c_1c_2$, $(c_1,c_2)=1$ one has
\begin{equation}\label{twistedmult}
\Kl_2(a;c)=\Kl_2(a\ov{c_2}^2;c_1)\Kl_2(a\ov{c_1}^2;c_2)
\end{equation}
so that by Weil's bound one has
$$|\Kl_2(a;c)|\leq 2^{\omega(c)}$$
where $\omega(c)$ is the number of prime factors of $c$. We can then define the corresponding Kloosterman angle by
$$\cos(\theta_{c,a})=\frac{\Kl_2(a;c)}{2^{\omega(c)}}.$$
It is then natural to make the following
\begin{conjecture}[Horizontal Sato-Tate law for Kloosterman sums with composite moduli]\label{katzconjk} Given  $k\geq 1$ un integer, let $\pi_k(X)$ be the number of squarefree integers $\leq X$ with exactly $k$ prime factors and let $\mu_{ST,k}$ be the Sato-Tate measure of order $k$, defined as the push-forward of the measure $\mu_{ST}^{\otimes k}$ on $[0,\pi]^k$ by the map
$$(\theta_1,\ldots,\theta_k)\in [0,\pi]^k\mapsto \arccos(\cos(\theta_1)\times\ldots\times\cos(\theta_k)))\in[0,\pi].$$
 for any $k\geq 1$, the multiset of Kloosterman angles
$$\{\theta_{c,1},\ c\leq X,\ c\hbox{ is squarefree with $k$ prime factors}\}$$  becomes equidistributed with respect to $\mu_{ST,k}$ as $X\rightarrow\infty$.
\end{conjecture}
This conjecture for any $k\geq 2$ seem as hard as the original one (and is not implies by it). On the other hand it is possible to establish some of its consequences:

\begin{theorem} There exists $k\geq 2$  such that
\begin{enumerate}
\item 	for infinitely many square-free integers $c$ with at most $k$ prime factors,$$|\Kl_2(1;c)|\geq 2017^{-2017};$$
 \item 	for infinitely many square-free integers $c$ with at most $k$ prime factors,$$\Kl_2(1;c)>0;$$
\item 	for infinitely many square-free integers $c$ with at most $k$ prime factors,$$\Kl_2(1;c)<0.$$
\end{enumerate}
\end{theorem}
The first statement above was proven in \cite{Mi1} for $k=2$ (with $2017^{-2017}$ replaced by $4/25$; the second and the third were first proven in \cite{FouMiAnn} for $k=23$; this value was subsequently improved by Sivak, Matom\"aki and Ping who holds the current record with $k=7$ \cite{Sivak,Matomaki,Xi,Xi2}.

\subsubsection{Kloosterman sums can be large} We start with the first statement which we prove for $c=pq$ a product of two distinct primes. The main idea is to use the twisted multiplicativity relation
$$\Kl_2(1;pq)=\Kl_2(\ov p^2;q)\Kl_2(\ov q^2;p)$$
and to establish the existence of some $\kappa$ for which there exist infinitely many pairs of distinct primes $(p,q)$ such that
$$|\Kl_2(\ov p^2;q)|\ |\Kl_2(\ov q^2;p)|\geq \kappa.$$
Indeed, for such pairs we have
$$|\Kl_2(1;pq)|\geq \kappa^2.$$
Given $X$ large, we will consider pairs $(p,q)$ such that $p,q\in[X^{1/2},2X^{1/2}[$ and will show that for $\kappa$ small enough the two sets
$$\{(p,q),\ p\not=q\in[X^{1/2},2X^{1/2}[,\ p,q\hbox{ primes}\ |\Kl_2(\ov p^2;q)|\geq \kappa\}$$
$$\{(p,q),\ p\not=q\in[X^{1/2},2X^{1/2}[,\ p,q\hbox{ primes}\ |\Kl_2(\ov q^2;p)|\geq \kappa\}$$
are large enough to have a non-empty (and in fact large) intersection as $X\rightarrow\infty$.
This is a consequence of the following equidistribution statement
\begin{proposition} Given $X\geq 1$, and a prime $q\in[X^{1/2},2X^{1/2}]$, the (multi)-set of Kloosterman angles
$$\{\theta_{q,\ov p^{2}},\ p\in[X^{1/2},2X^{1/2}[,\ p\hbox{ prime,}\ p\not=q\}$$ is equidistributed with respect to  the Sato-Tate measure: for any interval $[a,b]\subset [0,\pi]$
$$\frac{|\{p\in[X^{1/2},2X^{1/2}[,\ p\not=q\hbox{ prime,}\ \theta_{q,\ov p^{2}}\in[a,b]\}|}{|\{p\in[X^{1/2},2X^{1/2}[,\ p\not=q\hbox{ prime}\}|}\rightarrow \frac{2}\pi\int_a^b\sin^2(\theta)d\theta$$
 as $X\rightarrow\infty$.
\end{proposition}

\proof We consider the pull-back sheaf $\mathcal{K}:=[x\rightarrow x^{-2}]^*\mathcal{K}\ell_2$ whose trace function is given by
$x\rightarrow \Kl_2(\ov x^2;q)$. As a representation of the geometric Galois group, it corresponds to restricting the representation $\mathcal{K}\ell_2$ to a subgroup of index $2$. Since the geometric monodromy group of $\mathcal{K}\ell_2$ is $\SL_2$, the same is true for the pull-back (the algebriac group $\SL_2$ has no non-trivial finite-index subgroups); therefore
$$\Ggeomd{\mathcal{K}}=\Garithd{\mathcal{K}}=\SL_2.$$
The non-trivial irreducible representations of $\SL_2$ are the symmetric powers of the standard representation, $\mathrm{Sym}_k(\mathrm{Std}),\ k\geq 1$. Given $k\geq 1$ the composed sheaf $$\mathcal{K}_k=\mathrm{Sym}_k\circ\mathcal{K}$$ is by construction geometrically irreducible, has rank $k+1$ with conductor bounded in terms of $k$ only and its trace function equals
$$K_k(x)=\tr(\mathrm{Sym}_k\begin{pmatrix}e^{i\theta_{q,\ov x^{2}}}&0\\0&e^{-i\theta_{q,\ov x^{2}}}
\end{pmatrix})=\sum_{j=0}^ke^{i(k-j)\theta_{q,\ov x^{2}}}e^{-ij\theta_{q,\ov x^{2}}}=\frac{\sin((k+1)\theta_{q,\ov x^{2}})}{\sin(\theta_{q,\ov x^{2}})}.$$
 In particular $\mathcal{K}_k$ cannot be geometrically isomorphic to any tensor product of an Artin-Schreier sheaf and a Kummer sheaf (as they have rank $1$). Hence by a simple variant of Theorem \ref{thmprimesumthm} we obtain that
 $$\frac{1}{\pi(2X^{1/2})-\pi(X^{1/2})}\sum_\stacksum{p\not=q}{p\sim X^{1/2}}K_k(p)\rightarrow 0=\frac{2}\pi\int_0^\pi\frac{\sin((k+1)\theta)}{\sin(\theta)}\sin^2(\theta)d\theta$$
\qed

Averaging over $q$, we deduce the existence of some $\kappa>0$ ($\kappa=0,4$) such that for $X$ large enough
$$\frac{|\{(p,q),\ p\not=q\in[X^{1/2},2X^{1/2}[,\ p,q\hbox{ primes},\ |\Kl_2(\ov p^2;q)|\geq \kappa\}|}{|\{(p,q),\ p\not=q\in[X^{1/2},2X^{1/2}[,\ p,q\hbox{ primes}\}|}\geq 0,51$$
hence
\begin{equation}\label{lowerKl1}
{|\{(p,q),\ p\not=q\in[X^{1/2},2X^{1/2}[,\ p,q\hbox{ primes}\ |\Kl_2(1;pq)|\geq \kappa^2\}|}\geq (0,01+o(1))\frac{X}{(\frac12\log X)^2}.
\end{equation}

\subsubsection{Kloosterman sums change sign}
We now discuss briefly the proof of the remaining two statements: to establish the existence of sign changes, it suffices to prove that given $V\in\mathcal{C}_c^\infty(]1,2[)$ some non-zero non-negative smooth function, there exists $u>0$ such that, for $X$ large enough
\begin{equation}\label{compareKl}
\bigl|\sum_\stacksum{c\geq 1}{p|c\Rightarrow p\geq X^{1/u}}\Kl_2(1;c)V(\frac{c}X)\bigr|<\sum_\stacksum{c\geq 1}{p|c\Rightarrow p\geq X^{1/u}}|\Kl_2(1;c)|V(\frac{c}X).
\end{equation}
which will prove the existence of sign changes for Kloosterman sums $\Kl_2(1;c)$ whose modulus has at most $1/u$ prime factors.
Using sieve methods and the Petersson-Kuznetzov formulas to express sums of Kloosterman sums in terms of Fourier coefficients of modular forms (\eqref{Pet} and \eqref{Kuz}) and using the theory of automorphic forms, one can show that (see \cite{FouMiAnn} for a proof)

\begin{proposition} For any $\eta>0$, there exists $u=u(\eta)>0$ such that
$$\bigl|\sum_\stacksum{c\geq 1}{p|c\Rightarrow p\geq X^{1/u}}\Kl_2(1;c)V(\frac{c}X)\bigr|\leq \eta\frac{X}{\log X}$$
for $X$ large enough (depending on $\eta$ and $V$).
\end{proposition}

To conclude, it is sufficient to show that for some $u=u_0$, one has
\begin{equation}\label{lowerwish}
\sum_\stacksum{c\geq 1}{p|c\Rightarrow p\geq X^{1/u}}|\mu^2(c)\Kl_2(1;c)|V(\frac{c}X)\gg_{V} \frac{X}{\log X}
\end{equation}
(the left-hand side is an increasing function of $u$ so the above inequality remains valid for any $u\geq u_0$). The inequality \eqref{lowerKl1} points in the right direction (for $u_0=2$), however as stated it is off by a factor $\log X\log\log X$.
One can however recover this factor $\log X$ entierely and prove the lower bound
$$\sum_\stacksum{c\geq 1}{p|c\Rightarrow p\geq X^{3/8}}\mu^2(c)|\Kl_2(1;c)|V(\frac{c}X)\gg_{V} \frac{X}{\log X}.$$
The reason is that Theorem \ref{thmprimesumthm} applies also when $p$ is significantly smaller than $q$ ( if $q\simeq X^{1/2+\delta}$ one can obtain a non-trivial bound  in \eqref{primesumsmooth} for $p$ of size $X^{1/2-\delta}$ for $\delta\in[0,1/8[$). The details involve making a partition of unity and we leave it to the interested reader. Another possibility (the one followed originally in \cite{FouMiAnn}) is to establish the lower bound \eqref{lowerwish} for a suitable $u$ by restricting to moduli $c$ which are products of exactly three prime factors, using the techniques discussed so far.

 \section{Multicorrelation of trace functions}\label{multisec}
So far we have mainly discussed the evaluation of correlation sums associated to two trace functions $K_1$ and $K_2$ (especially the case $K_1=K$ and $K_2=\gamma^*K$), namely
$$\mathcal{C}(K_1,K_2)=\frac{1}q\sum_{x}K_1(x)\ov{K_2(x)}.$$

In many applications, multiple correlation sums occur: sums of the shape
$$\mathcal{C}(K_1,K_2,\ldots, K_{L}):=\frac{1}q\sum_{x}K_1(x)K_2(x)\ldots K_L(x)$$
where the $K_i,\ i=1,\ldots, L$ are trace functions; of course rewriting the inner term of the sum above as a product of two factors reduces to evaluating a double correlation sum, say associated to the sheaves
$$\mathcal{F}=\mathcal{K}_1\otimes\ldots\mathcal{K}_{l},\ \mathcal{G}=\mathcal{K}_{l+1}\otimes\ldots\mathcal{K}_{L}$$
but it would remain to determine if $\mathcal{F}$ and $\mathcal{G}$ share a common irreducible component and this may be a hard task. In practice, the multicorrelation sums that occur (due to the application of some H\"older inequality and of the P\'olya-Vinogradov method) are often of the shape
$$\mathcal{C}(K,\uple{\gamma},h)=\frac{1}q\sum_{x}K(\gamma_1\cdot x)\ldots K(\gamma_l\cdot x)\ov{K(\gamma'_1\cdot x)\ldots K(\gamma'_l\cdot x)}\mathrm{e}_q(xh)$$
for $K$ the trace function of some geometrically irreducible sheaf $\mathcal{F}$, pure of weight $0$,
$${\uple{\gamma}}=(\gamma_1,\ldots,\gamma_l,\gamma'_1,\ldots,\gamma'_l)\in\PGL_2({\mathbf{F}_q})^{2l}$$   and some $h\in{\mathbf{F}_q}$.

 This sum is the correlation associated to the trace functions of the sheaves
$$\gamma_1^*\mathcal{F}\otimes\ldots\otimes\gamma_l^*\mathcal{F}\ \hbox{and }{\gamma'}_1^*\mathcal{F}\otimes\ldots\otimes{\gamma'}_l^*\mathcal{F}\otimes\mathcal{L}_\psi$$
whose conductors are bounded polynomially in terms of $C(\mathcal{F})$. If $\mathcal{F}$ has rank one, the two sheaves above have rank one and it is usually not difficult to determine whether these sheaves are geometrically isomorphic or not.

For $\mathcal{F}$ of higher rank, we describe a method due to Katz which has been axiomatized in \cite{FKMSP}: this method rests on the notion of geometric monodromy group which we discussed in the previous section.

 \subsection{A theorem on sums of products of trace functions}
 In this section we discuss some general result making it possible to evaluate multicorrelations sums of trace functions of interest for analytic number theory. The method is basically due to Katz and was used on several occasions, for instance in \cite{Mi1,FoMi}. The general result presented here is a special case of the results of \cite{FKMSP}. For this we need to introduce the following variants of the group of automorphism of a sheaf: one is the group of projective automorphisms
$$\Aut^p_\mathcal{F}({\mathbf{F}_q})=\{\gamma\in\PGLd({\mathbf{F}_q}),\ \exists \hbox{ some rank one sheaf $\mathcal{L}$ s.t. }\gamma^*\mathcal{F}\simeq_{geom}\mathcal{F}\otimes\mathcal{L}\},$$
the other is the right-$\Aut^p_\mathcal{F}({\mathbf{F}_q})$-orbit
$$\Aut^d_\mathcal{F}({\mathbf{F}_q})=\{\gamma\in\PGLd({\mathbf{F}_q}),\ \exists \hbox{ some rank one sheaf $\mathcal{L}$ s.t. }\gamma^*\mathcal{F}\simeq_{geom}D(\mathcal{F})\otimes\mathcal{L}\}.$$
Let $\mathcal{F}$ be a weight $0$, rank $k$, irreducible sheaf. We assume that
\begin{itemize}
\item the geometric monodromy group equals $\Ggeomd{\mathcal{F}}=\SL_k\hbox{ or }\Sp_k,$ (we then say that $\mathcal{F}$ is of $\SL$ or $\Sp$-{\em type}),
\item the equality \eqref{eqGarithincluded} holds,
\item 	$\Aut^p_\mathcal{F}({\mathbf{F}_q})=\{\mathrm{Id}\}$; in particular $\Aut^d_\mathcal{F}({\mathbf{F}_q})$ is either empty or is reduced to a single element, $\xi_\mathcal{F}$ which is a possibly trivial involution ($\xi_\mathcal{F}^2=\mathrm{Id}$) and is called the {\em special involution.}
\end{itemize}

\begin{example} The Kloosterman sheaves $\mathcal{K}\ell_k$ have this property \cite{GKM}. The special involution is either $\mathrm{Id}$ if $k$ is even ($\mathcal{K}\ell_k$ is self-dual) or the matrix
$\xi=\begin{pmatrix}-1&\\&1
\end{pmatrix}$ for $k$ odd.
\end{example}

Finally we introduce the following ad-hoc definition:
\begin{definition} Given $${\uple{\gamma}}=(\gamma_1,\ldots,\gamma_l,\gamma'_1,\ldots,\gamma'_l)\in\PGL_2({\mathbf{F}_q})^{2l},$$ one says that
\begin{itemize}
\item ${\uple{\gamma}}$ is normal if there is $\gamma\in\PGLd({\mathbf{F}_q})$ such that $$|\{i,\ \gamma_i=\gamma\}|+|\{j,\ \gamma'_j=\gamma\}|\equiv 1\mods 2.$$
\item For $k\geq 3$,	${\uple{\gamma}}$ is $k$-normal if there exists $\gamma\in\PGLd({\mathbf{F}_q})$ such that
$$|\{i,\ \gamma_i=\gamma\}|-|\{\gamma'_j=\gamma\}|\not\equiv 0\mods k.$$
\item For $k\geq 3$, and $\xi\in\PGLd({\mathbf{F}_q})$ a non-trivial involution, ${\uple{\gamma}}$ is $k$-normal w.r.t. $\xi$ if there exist $\gamma\in\PGLd({\mathbf{F}_q})$ such that
 $$|\{i,\ \gamma_i=\gamma\}|+|\{j,\ \gamma'_j=\xi\gamma\}|-|\{j,\ \gamma'_j=\gamma\}|-|\{i,\ \gamma_i=\xi\gamma\}|\not\equiv 0\mods{k}.$$
\end{itemize}

\end{definition}

\begin{theorem}\label{cor-concrete}
  Let $K$ be the trace function of a
   sheaf $\mathcal{F}$ as above, $l\geq 1$, $\uple{\gamma}\in\PGL_2({\mathbf{F}_q})^{2l}$ and $h\in{\mathbf{F}_q}$. We assume that either
   \par
\emph{(1)} the sheaf $\sheaf{F}$ is self-dual (so that $K$ is real-valued) and $\uple{\gamma}$ is normal
\par
\emph{(2)} the $\sheaf{F}$ is of $\SL$-type of rank $k\geq 3$,
$q>r$, and $\uple{\gamma}$ is
$k$-normal or $k$-normal w.r.t. the special involution of
$\sheaf{F}$, if it exists.
\par
\emph{(3)} or $h\not=0$.

We have
$$\mathcal{C}(K,\uple{\gamma},h)=\frac{1}q\sum_{x}K(\gamma_1\cdot x)\ldots K(\gamma_l\cdot x)\ov{K(\gamma'_1\cdot x)\ldots K(\gamma'_l\cdot x)}\mathrm{e}_q(xh)\ll_{l,C(\mathcal{F})}\frac{1}q^{1/2}.$$

\end{theorem}

\proof We discuss the proof only in the self-dual case for simplicity. We group together identical $\gamma_i,\gamma_j'$ and the sum becomes
$$\frac{1}q\sum_{x}K(\gamma''_1\cdot x)^{m_1}\ldots K(\gamma''_{t}\cdot x)^{m_t}\mathrm{e}_q(xh)$$
where $t\leq 2l$, the $\gamma''_i$ are distinct and by hypothesis one of the $m_i$ is odd. The above sum is associated to the trace function of the sheaf
$$\bigotimes_{i=1}^t \mathrm{Std}(\gamma_i''^*\mathcal{F})^{\otimes{m_i}}\otimes \mathcal{L}_\psi$$
where $\psi(\cdot)=\mathrm{e}_q(h\cdot)$ and $\mathrm{Std}$ is the tautological representation.
We decompose each representation into irreducible
$$\rho_{m,0}=\mathrm{Std}(G)^{\otimes m}=\sum_{r}m_r(\rho_{m,0})r$$
and are reduced to considering various sheaves of the shape
\begin{equation}\label{eqlesheaf}
\bigotimes_{i=1}^t r_i(\gamma_i''^*\mathcal{F})\otimes \mathcal{L}_\psi
\end{equation}
where  $(r_i)_{i\leq t}$ is a tuple of irreducible representations of $G$; by our hypothesis, we know that either $\mathcal{L}_\psi$ is not trivial or at least one of the $r_i$ is not trivial (and necessarily of dimension $>1$).

It is then sufficient to show that, under these assumptions, the sheaves \eqref{eqlesheaf} are irreducible. For this we consider the direct sum sheaf
$$\bigoplus_i\gamma_i''^*\mathcal{F}$$
and let $\Ggeomd{\oplus}\subset \prod_i G$ be the Zariski closure of the image of $G^{\mathrm{geom}}$ under the sum of representations.
The following very useful criterion is due to Katz

\begin{theorem}[Goursat-Kolchin-Ribet criterion] Let $(\mathcal{F}_i)_i$ be a tuple of geometrically irreducible sheaves lisse on $U\subset \mathbf{A}^1_{{\mathbf{F}_q}}$, pure of weight $0$, with geometric monodromy groups $G_i$. We assume that
\begin{itemize}
	\item For every $i$, $G_i=\Sp_{k_i}$ or $\SL_{k_i}$,
	\item for any rank $1$ sheaf $\mathcal{L}$ and any $i\not=j$ there is no geometric isomorphism between $\mathcal{F}_i\otimes\mathcal{L}$ and $\mathcal{F}_j$,
	\item for any rank $1$ sheaf $\mathcal{L}$ and any $i\not=j$ there is no geometric isomorphism between $\mathcal{F}_i\otimes\mathcal{L}$ and $D(\mathcal{F}_j)$.
\end{itemize}
Then the geometric monodromy group of the sheaf
$\bigoplus_i\mathcal{F}_i$ equals $\prod_i G_i$ .
\end{theorem}
Our assumptions (the projective automorphism group of $\mathcal{F}$ is trivial, $\uple{\gamma}$ is normal
and the geometric monodromy group is either $\SL$ or $\Sp$) imply that the above criterion holds and this implies that
$$\bigotimes_i r_i(\gamma_i''^*\mathcal{F})\otimes \mathcal{L}_\psi$$
is always irreducible.
\qed

\subsection{Application to non-vanishing of Dirichlet $L$-functions}
We now discuss a beautiful application of bounds for multicorrelation sums due to R. Khan and H. Ngo \cite{KhNg}. It concerns the proportion of non-vanishing of Dirichlet $L$-functions at the central point $1/2$. The interest in this kind of problems from analytic number theory was renewed with the work of Iwaniec and Sarnak in their celebrated attempt to prove the non-existence of a Landau-Siegel zero \cite{IS1}. Their approach was based on the following general problem: {\em given  a  family of $L$-functions
$$\{L(f,s)=\sum_{n\geq 1}\frac{\lambda_f(n)}{n^s},\ f\in\mathcal{F}\}$$indexed by a "reasonable" family of automorphic forms $\mathcal{F}$\footnote{A reasonable definition of the notion of "reasonable" can be found in \cite{K,SST}}, show that for many $f\in\mathcal{F}$, one has $$L(f,1/2)\not=0.$$ }

	In their work \cite{IS1}, Iwaniec and Sarnak  showed specifically that for $\mathcal{F}=\mathcal{S}_2(q)$ the set of holomorphic new-forms of weight $2$ and  prime level $q$ (with trivial nebentypus), if one could show that for  $q$ large enough at least $(25+2017^{-2017})\%$ of the central $L$-values $L(f,1/2)$ do not vanish (more precisely that at least $(25+2017^{-2017})\%$ of these central values are larger than $\log^{-2017}q$ ) then there would be no Landau-Siegel zero. They eventually proved
	\begin{theorem}[\cite{IS1}] As $q\rightarrow\infty$ along the primes one has
$$\frac{|\{f\in \mathcal{S}_2(q),\ L(f,1/2)\geq \log^{-2}q\}|}{|\mathcal{S}_2(q)|}\geq 1/4-o(1).$$
\end{theorem}
This is "just" at the limit.

The possibility of producing a positive proportion of non-vanishing is not limited to this specific family and one of the most powerful and general tools  to achieve this is via the {\em mollification method}. The principle of mollification method is as follows: given the family $\mathcal{F}$, one considers for some parameter $L\geq 1$ and some suitable vector $\uple{x}_L=(x_\ell)_{\ell\leq L}\in\mathbf{C}^{\ell}$ the linear
form
\begin{equation}\label{linear}
\mathcal{L}(\mathcal{F},\uple{x}_L):=\frac{1}{|\mathcal{F}|}\sum_{f\in\mathcal{F}}L(f,1/2)M(f,\uple{x}_L)
\end{equation}
and the quadratic form
\begin{equation}\label{quadratic}
\mathcal{Q}(\mathcal{F},\uple{x}_L):=\frac{1}{|\mathcal{F}|}\sum_{f\in\mathcal{F}}|L(f,1/2)M(f,\uple{x}_L)|^2
\end{equation}
where $M(f,\uple{x}_L)$ is the linear form (called "mollifier")
$$M(f,\uple{x}_L)=\sum_{\ell\leq L}\frac{\lambda_f(\ell)}{\ell^{1/2}}x_\ell$$
and the $x_\ell$ are coefficients to be chosen in an optimal way with the idea of approximating the inverse $L(f,1/2)^{-1}$. Such coefficients are almost bounded,  i.e.~satisfy:
$$x_\ell= |\mathcal{F}|^{o(1)}.$$
By Cauchy's inequality one has
$$\frac{|\{f\in\mathcal{F},\ L(f,1/2)\not=0\}|}{{|\mathcal{F}|}}\geq \frac{|\mathcal{L}(\mathcal{F},\uple{x}_L)|^2}{\mathcal{Q}(\mathcal{F},\uple{x}_L)}.$$
For suitable families one can evaluate asymptotically $\mathcal{L}(\mathcal{F},\uple{x}_L)$ and $\mathcal{Q}(\mathcal{F},\uple{x}_L)$ (the hard case being $\mathcal{Q}$) when $L=|\mathcal{F}|^\lambda$ for $\lambda>0$ some fixed constant
and (upon minimizing $\mathcal{Q}(\mathcal{F},\uple{x}_L)$ with respect to $\mathcal{L}(\mathcal{F},\uple{x}_L)$) one usually shows that
\begin{equation}\label{ratiomolli}
\frac{|\mathcal{L}(\mathcal{F},\uple{x}_L)|^2}{\mathcal{Q}(\mathcal{F},\uple{x}_L)}=F(\lambda)+o(1)
\end{equation}
for $F$ some increasing rational fraction with $F(0)=0$. In \cite{IS1}, Iwaniec and Sarnak have also implemented this strategy for the (simpler) family of Dirichlet $L$-functions of modulus $q$
$$\{L(\chi,s)=\sum_{n\geq 1}\frac{\chi(n)}{n^s},\ \chi\in\widehat{(\mathbf{Z}/q\mathbf{Z})^\times}\}$$
and were able to evaluate \eqref{linear} and \eqref{quadratic} for any $\lambda<1/2$ and to prove \eqref{ratiomolli} with
$$F(\lambda)=\frac{\lambda}{\lambda+1}$$
hence:
\begin{theorem}[\cite{IS2}] As $q\rightarrow\infty$ along the primes one has
$$\frac{|\{\chi\mods q,\ L(\chi,1/2)\not=0\}|}{|\{\chi\mods q\}|}\geq 1/3-o(1).$$
\end{theorem}
 Thus  the proportion of non-vanishing  can be arbitrarily close to $33.33\dots\%$.
Shortly after, Michel and Vanderkam \cite{MvdK} obtained the same proportion by a slightly different method: taking into account the fact that for a complex character, the $L$-function $L(\chi,s)$ is not self-dual ($L(\chi,s)\not=L(\ov\chi,s)$) and has root number
$$\varepsilon_\chi=i^{\mathfrak{a}}\frac{\tau(\chi)}{q^{1/2}},\ \mathfrak{a}=\frac{\chi(-1)-1}2$$ were $\tau(\chi)$ is the  Gauss sum, they introduced a symmetrized mollifier of the shape
$$M^s(\chi,\uple{x}_L)=M(\chi,\uple{x}_L)+\ov{\varepsilon_\chi}M(\ov \chi,\uple{x}_L)=\sum_{\ell\leq L}\frac{\chi(\ell)+\ov{\varepsilon_\chi}.\ov\chi(\ell)}{\ell^{1/2}}x_\ell.$$
Because of the oscillation of the root number $\varepsilon_\chi$, they could evaluate \eqref{quadratic} only in the shorter range $\lambda<1/4$. However this weaker range is offset by the fact that the symmetrized mollifier is more effective: indeed the rational fraction $F(\lambda)$ is then replaced by
$$F^s(\lambda)=\frac{2\lambda}{2\lambda+1}$$
which takes value $1/3$ at $\lambda=1/4$.

Recently R. Khan and H. Ngo founds a better method to bound the exponential sums considered in \cite{MvdK} building on Theorem \ref{cor-concrete} and they increased the allowed range from $\lambda<1/4$ to $\lambda<3/10$:
\begin{theorem}[\cite{KhNg}]\label{KhNgthm} As $q\rightarrow\infty$ along the primes one has
$$\frac{|\{\chi\mods q,\ L(\chi,1/2)\not=0\}|}{|\{\chi\mods q\}|}\geq 3/8-o(1).$$
\end{theorem}
The key step in their proof is the asymptotic evaluation of the second mollified moment
\begin{equation}\label{2ndchi}
\frac{1}{\varphi(q)}\sum_{\chi\mods q}|L(\chi,1/2)|^2|M^s(\chi,\uple{x}_L)|^2
\end{equation}
for $L=q^\lambda$, and any fixed $\lambda<3/10$. By (nowadays) standard methods\footnote{inappropriately called "approximate functional  equation"} the $L$-value $L(\chi,1/2)$ can be written as a sum of rapidly converging series (cf.~\cite[Theorem 5.3]{IwKo}): for $q$ prime and $\chi\not=1$
$$|L(\chi,1/2)|^2=2\sum_{n_1,n_2\geq 1}\frac{\chi(n_1)\ov\chi(n_2)}{(n_1n_2)^{1/2}}V(\frac{n_1n_2}{q})$$
where $V$ is a rapidly decreasing function which depends on $\chi$ only through its parity $\chi(-1)=\pm 1$. Plugging this expression in the second moment \eqref{2ndchi} and unfolding, one finds that  the key point is to obtain a bound of the following shape\footnote{for simplicity we ignore the dependency of $V$ in the parity of the $\chi$'s}
\begin{equation}\label{KhNggoal}
\sumsum_\stacksum{\ell_1,\ell_2\leq L,n_1,n_2}{(l_1l_2n_1n_2,q)=1}\frac{x_{l_1}\ov{x_{l_2}}}{(ql_1l_2n_1n_2)^{1/2}}V(\frac{n_1n_2}q)e\left(\frac{n_2\ov{l_1l_2n_1}}{q}\right)\ll q^{-\delta}
\end{equation}
for some $\delta=\delta(\lambda)>0$ for any fixed $\lambda<3/10$. This sum can  be decomposed in various sub-sums in which the variables are localized to specific ranges. The problem becomes essentially that of bounding by $O(q^{-\delta})$ the family of bilinear sums
$$\Sigma(L_1,L_2,N_1,N_2)=\frac{1}{(qL_1L_2N_1N_2)^{1/2}}\sumsum_\stacksum{l_i\sim L_i,i=1,2}{n_1,n_2}x_{l_1}\ov{x_{l_2}}W(\frac{n_1}{N_1})W(\frac{n_2}{N_2})e\left(\frac{n_2\ov{l_1l_2n_1}}{q}\right)$$
where $W\in\mathcal{C}_c(]1/2,2[)$, $L_1,L_2\leq L$ and $N_1N_2\leq q$.

The $n_2$-sum is essentially a geometric series bounded by
$$\ll \min(N_2,{\|\ov{l_1l_2n_1}/q\|^{-1}})$$
where $\|\cdot\|$ is the distance to the nearest integer. Hence
\begin{align}
\nonumber
\Sigma(L_1,L_2,N_1,N_2)&\ll \frac{q^\varepsilon}{(qL_1L_2N_1N_2)^{1/2}}\sum_{m\approx L_1L_2N_1}\min(N_2,{\|\ov{m}/q\|^{-1}})\\
&\ll\frac{q^{2\varepsilon}}{(qL_1L_2N_1N_2)^{1/2}}\mathop{\mathrm{Max}}\limits_{1\leq U\leq q/2}\min(N_2,\frac{q}{U})\sumsum_\stacksum{m\approx L_1L_2N_1,\ ,\ u\sim U}{um\equiv \pm 1\mods q}1\nonumber\\
\nonumber
&\ll\frac{q^{2\varepsilon}}{(qL_1L_2N_1N_2)^{1/2}}\mathop{\mathrm{Max}}\limits_{1\leq U\leq q/2}\min(N_2,\frac{q}{U})(\frac{L_1L_2N_1U}{q}+1)\\
&\ll
q^{2\varepsilon}\frac{L}{q^{1/2}}(\frac{N_1}{N_2})^{1/2}.\label{KNbound1}
\end{align}
(Observe that for $\frac{L_1L_2N_1U}{q}\ll 1$ the equation $um\equiv\pm 1\mods q$ has no solution unless $L_1L_2N_1U\ll 1$).

Alternatively, applying the Poisson summation formula to the $n_1$ variable we obtain a sum of the shape
$$\Sigma(L_1,L_2,N_1,N_2)=\frac{1}{(qL_1L_2N_1N_2)^{1/2}}\frac{N_1}{q^{1/2}}\sumsum_\stacksum{l_i\sim L_i,i=1,2}{n_1,n_2}x_{l_1}\ov{x_{l_2}}\widetilde W(\frac{n_1}{q/N_1})W(\frac{n_2}{N_2})\Kl_2(\ov{l_1l_2}n_1n_2;q)$$
where $\widetilde W$ is bounded and rapidly decreasing. Bounding this sum trivially (using that $|\Kl_2(m;q)|\leq 2$) yields
\begin{equation}\label{trivialbound12}
\Sigma(L_1,L_2,N_1,N_2)\ll q^{\varepsilon}L(\frac{N_2}{N_1})^{1/2}.
\end{equation}
The expression $\min(\frac{L}{q^{1/2}}(\frac{N_1}{N_2})^{1/2},L(\frac{N_2}{N_1})^{1/2})$ is maximal for $\frac{N_1}{N_2}=q^{1/2}$ and equals $L/q^{1/4}$ which is $O(q^{-\delta})$ if $\lambda<1/4$.

 The bound \eqref{trivialbound12} did not exploit cancellation from the $n_1,n_2,l_1,l_2$ averaging and indeed this is not evident because in the limiting case $N_1=q^{3/4},\ N_2=q/N_1=q^{1/4}$, $L_1=L_2=L=q^{1/4}$, one has $$n_1\approx n_2\approx l_1\approx l_2\approx q^{1/4}$$ which is pretty short. Nevertheless Khan and Ngo where able to detect further cancellation from summing of these short variables. The idea, which we have met already, is to group some of these variables to form longer variables. One possibility could be to group together $n_1$, $n_2$ on the one hand and $l_1$, $l_2$ on the other hand with the idea of applying the methods of \S \ref{secbilinear}. However, the new variables would have size $q^{1/2}$, which is the P\'olya-Vinogradov range at which point the standard completion method just fails. Instead, one can group $n_1$, $n_2$ and $l_2$ together and leave $l_1$ alone. The variable $r=n_1n_2\ov{l_2}\mods q$ takes essentially $q^{3/4}$ distinct values but over all of ${\mathbf{F}^\times_q}$ and does not vary along an interval. To counter this defect, one uses the Holder inequality instead of Cauchy-Schwarz.

Proceeding as above, we write
 $$\Sigma(L_1,L_2,N_1,N_2)=\frac{1}{(qL_1L_2N_1N_2)^{1/2}}\frac{N_1}{q^{1/2}}\sumsum_{r\in{\mathbf{F}^\times_q},l_1}x_{l_1}\nu(r)\Kl_2(\ov{l_1}r;q)$$
 where
 $$\nu(r)=\sumsum_\stacksum{l_2,n_1,n_2}{r=n_1n_2\ov{l_2}(q)}\ov{x_{l_2}}\widetilde W(\frac{n_1}{q/N_1})W(\frac{n_2}{N_2}).$$

Under the assumption
\begin{equation}\label{moment2hyp}
	L_2\frac{q}{N_1}N_2<q/100\Longrightarrow  L_2\frac{N_2}{N_1}<1/100
\end{equation}
we have
 $$\sum_r|\nu(r)|+\sum_r|\nu(r)|^2\ll q^\varepsilon L_2\frac{q}{N_1}N_2.$$
 Indeed under \eqref{moment2hyp} one has
 $$\ov l_2n_1n_2\equiv \ov l'_2n'_1n'_2\mods q \Longleftrightarrow  l'_2n_1n_2\equiv l_2n'_1n'_2\mods q \Longleftrightarrow l'_2n_1n_2= l_2n'_1n'_2$$
 and the choice of $l'_2,n_1,n_2$ determines $l_2,n'_1,n'_2$ up to $O(q^\varepsilon)$ possibilities.
Hence, applying Cauchy's inequality twice, we obtain
 $$\Sigma(L_1,L_2,N_1,N_2)=\frac{q^\varepsilon}{(qL_1L_2N_1N_2)^{1/2}}\frac{N_1}{q^{1/2}}(L_2\frac{q}{N_1}N_2)^{3/4}\left(\sum_{r\in{\mathbf{F}^\times_q}}|\sum_{l\sim L_1}x_l\Kl_2(\ov lr;q)|^4\right)^{1/4}.$$

Now (using that $\Kl_2(n;q)\in\mathbf{R}$)
$$\sum_{r\in{\mathbf{F}^\times_q}}|\sum_{l\sim L_1}x_l\Kl_2(\ov lr;q)|^4\ll q^\varepsilon\sum_\uple{l}|\sum_{r\in{\mathbf{F}^\times_q}}\prod_{i=1}^4\Kl_2(\ov{l_i}r;q)|$$
where $\uple{l}=(l_1,l_2,l_3,l_4)\in[L_1,2L_1[^4$.

Theorem \ref{cor-concrete}, applied to the Kloosterman sheaf, gives
$$\sum_{r\in{\mathbf{F}^\times_q}}\prod_{i=1}^4\Kl_2(\ov{l_i}r;q)\ll q^{1/2}$$
unless there exists a partition $\{1,2,3,4\}=\{i,j\}\sqcup\{k,l\}$ such that
$$l_i=l_j,\ l_k=l_l.$$
In this case, we use the trivial bound
 $$\sum_{r\in{\mathbf{F}^\times_q}}\prod_{i=1}^4\Kl_2(\ov{l_i}r;q)\ll q.$$
 Hence
$$\sum_\uple{l}|\sum_{r\in{\mathbf{F}^\times_q}}\prod_{i=1}^4\Kl_2(\ov{l_i}r;q)|\ll L_1^2q+L_1^4q^{1/2}$$
and
\begin{align}\nonumber
\Sigma(L_1,L_2,N_1,N_2)&\ll\frac{q^\varepsilon}{(qL_1L_2N_1N_2)^{1/2}}\frac{N_1}{q^{1/2}}(L_2\frac{q}{N_1}N_2)^{3/4}(L_1^{1/2}q^{1/4}+L_1q^{1/8})\\
&\ll q^{\varepsilon}L(\frac{N_2}{N_1})^{1/2}(Lq\frac{N_2}{N_1})^{-1/4}(L^{-1/2}q^{1/4}+q^{1/8}).	\label{KhNgbound3}
\end{align}
For $L\geq q^{1/4}$ (the range one would like to improve) one obtains under \eqref{moment2hyp}
\begin{equation}\label{KhNgbound3final}
	\Sigma(L_1,L_2,N_1,N_2)
\ll q^{\varepsilon}L(\frac{N_2}{N_1})^{1/2}(Lq^{1/2}\frac{N_2}{N_1})^{-1/4}.
\end{equation}

Suppose now we are in a limiting case for \eqref{trivialbound12}, namely
$L^2N_2/N_1=1$. Then \eqref{moment2hyp} holds as long as $L\gg 1$ and \eqref{KhNgbound3final} improves over \eqref{trivialbound12} by a factor $(q^{1/2}/L)^{1/4}$, which is $<1$ as long as $L< q^{1/2}$.

A more detailed analysis combining \eqref{KNbound1}, \eqref{trivialbound12} and \eqref{KhNgbound3final} shows that \eqref{KhNggoal} holds for any fixed $\lambda<3/10$, and hence leads to Theorem \ref{KhNgthm}.

\section{Advanced completion methods: the $q$-van der Corput method}
In this section and the next ones, we discuss general methods to evaluate trace functions along intervals of length smaller than the P\'olya-Vinogradov range discussed in \S \ref{Secshort}.

\subsection{The $q$-van der Corput method} One of the most basic techniques encountered in analytic number to estimate sums of (analytic) exponentials is the {\em van der Corput method} (see \cite[Chap. 8]{IwKo}). The $q$-Van der Corput method is an arithmetic variant due to Heath-Brown which replace archimedean analysis with $q$-adic analysis. That method concerns $c$-periodic functions for $c$ a {\em composite number}. Suppose (to simplify the presentation) that $c=pq$ for two primes $p$ and $q$ and let
$$K_c=K_pK_q\colon \mathbf{Z}/c\mathbf{Z}\to \mathbf{C}$$ be some function modulo $c$ which is the product of two trace functions modulo $p$ and $q$ (of conductor bounded by some constant $C$). We consider the sum
$$S_V(K,N):=\sum_{n}K_c(n)V(\frac nN)=\sum_{n}K_p(n\mods p)K_q(n\mods q)V(\frac nN)$$
where $V\in\mathcal{C}^\infty(]1,2[)$ and $2N<c=pq$.
We will explain the proof of the following result
\begin{theorem}[$q$-van der Corput method] Let $c=pq$ a product of two primes and $K_c=K_p.K_q$ as above; assume that $K_q$ is the trace function associated with a geometrically irreducible sheaf $\mathcal{F}$, which is not geometrically isomorphic to a linear or quadratic phase (i.e.~not of the shape $[P]^*\mathcal{L}_\psi$ for $P$ a polynomial of degre $\leq 2$). Then for $2N<pq$, we have
$$S_V(K_c,N)\ll_C N^{1/2}(p+q^{1/2})^{1/2}.$$
\end{theorem}
\begin{remark}This bound is non trivial as long as $$N\geq \mathop{\mathrm{Max}}\limits(p,q^{1/2}),$$
which is a weaker condition than $N\geq (pq)^{1/2}$ as long as
$$1<p<q.$$
We have therefore improved over the P\'olya-Vinogradov range; moreover the range of non triviality is maximal when $p\approx c^{1/3}$ and $q\approx c^{2/3}$. In that case,  one obtains
\begin{equation}\label{optimalvdC}
S_V(K,N)\ll_C N^{1/2}c^{1/6}
\end{equation}
which is non-trivial as long as
$$N\geq c^{1/3}.$$
\end{remark}

\proof The proof makes use of the (semi-)invariance of $K$ under  translations:
$$K(n+ph)=K_p(n)K_q(n+ph).$$
For $H\leq N/100p$ we have
$$S_V(K,N)=\frac{1}{2H+1}\sum_{|h|\leq H}\sum_{n}K_p(n)K_q(n+ph)V(\frac {n+ph}N)
$$
$$= \frac{1}{2H+1}\sum_{|n|\leq 3N}K_p(n)\sum_{|h|\leq H}K_q(n+ph)V(\frac {n+ph}N)$$
$$\ll \frac{1}{2H+1}N^{1/2}\bigl(\sum_{|n|\leq 3N}\bigl|\sum_{|h|\leq H}K_q(n+ph)V(\frac {n+ph}N)\bigr|^2\bigr)^{1/2}$$
$$=\frac{N^{1/2}}{H}\bigl(\sumsum_{|h|,|h'|\leq H}\sum_{n}K_q(n+ph)\ov{K_q(n+ph')}W_{p,h,h'}(\frac{n}N)\bigr)^{1/2}$$
where
$$W_{p,h,h'}(\frac{n}N)=V(\frac {n+ph}N)\ov{V(\frac {n+ph'}N)}.$$
We split the $h,h'$-sum into its diagonal and non-diagonal contribution
$$\sumsum_{|h|,|h'|\leq H}\ldots=\sumsum_\stacksum{|h|,|h'|\leq H}{h=h'}\ldots+\sumsum_\stacksum{|h|,|h'|\leq H}{h\not=h'}\ldots\ .$$
The diagonal sum contributes by $O(NH)$ and it remains to consider the correlation sums
$$\mathcal{C}(K_q,h,h'):=\sum_{n}K_q(n+ph)\ov{K_q(n+ph')}W_{p,h,h'}(\frac{n}N)$$
for $h\not=h'$.

Observe that this is the sum of a trace function of modulus $q$ of length $\approx N$. By comparison with the initial sum, we had a trace function of modulus ${pq}$ of length $\approx N$ so the relative length of $n$ compared to the modulus has increased ! By the P\'olya-Vinogradov method, it is sufficient to determine whether the sheaf
$$[+ph]^*\mathcal{F}\otimes [+ph']^*D(\mathcal{F})$$
has an Artin-Schreier sheaf in its irreducible components. This is equivalent to whether one has an isomorphism
$$[+p(h-h')]^*\mathcal{F}\simeq \mathcal{F}\otimes\mathcal{L}_\psi$$
for some Artin-Schreier sheaf. We will answer this question in a slighly more general form:
\begin{definition} For $d$ an integer satisfying  $1\leq d<q$, a polynomial phase sheaf of degree $d$ is a sheaf of the shape
$[P]^*\mathcal{L}_\psi$ for $P$ a polynomial of degree $d$ and $\psi$ a non-trivial additive character. It is lisse on $\mathbf{A}^1_{{\mathbf{F}_q}}$, ramified at infinity with Swan conductor equal to $d$ and its trace function equals $$x\mapsto \psi(P(x)).$$

\end{definition}
 We can now invoke the following
\begin{proposition}[\cite{Polymath8a}] Let $d$ be an integer satisfying  $1\leq d<q$. Suppose that $\mathcal{F}$ is geometrically irreducible, not isomorphic to a polynomial phase of degree $\leq d$  and that $C(\mathcal{F})\leq q^{1/2}$. Then for any $h\in{\mathbf{F}_q}-\{0\}$ and any non-constant polynomial $P$ of degree $\leq d-1$,$$[+h]^*\mathcal{F}\hbox{ and } \mathcal{F}\otimes [P]^*\mathcal{L}_\psi$$
are not geometrically isomorphic.

\end{proposition}
\proof We will only give the easiest part of it and refer to \cite[Thm. 6.15]{Polymath8a} for the complete argument. Suppose that $\mathcal{F}$ is ramified at some point $x_0\in\mathbf{A}^1(\ov{{\mathbf{F}_q}})$, since polynomial phases are ramified only at $\infty$ the isomorphism $$[+h]^*\mathcal{F}\simeq \mathcal{F}\otimes [P]^*\mathcal{L}_\psi$$
restricted to the inertia group $I_x$
 implies that $\mathcal{F}$ is ramified at $x_0-h$ and iterating at $x_0-nh$ for any $n\in\mathbf{Z}$, this would imply that $C(\mathcal{F})\geq q$ which is excluded. It remains to deal with the case where $\mathcal{F}$ is ramified only at $\infty$.
\qed

Under our assumptions the above proposition implies that for $h\not=h'$
$$\mathcal{C}(K_q,h,h')=O(q^{1/2})$$ and that
$$S_V(K,N)\ll N^{1/2}(\frac{N}{H}+q^{1/2})^{1/2}$$
and we choose $H=N/100 p$ to conclude the proof.

\qed

\subsection{Iterating the method} Suppose more generally that $c$ is a squarefree number and that
$$K_c=\prod_{q|c}K_q$$
is a product of trace functions associated to sheaves not containing any polynomial phases. One can repeat the above argument after factoring $c$ into a product of squarefree coprime moduli $r.s$ and decompose accordingly $$K_c=K_r.K_s.$$
Thus, we  have to bound sums of the shape
\begin{equation}\label{ssum}
	\sum_{n}K_s(n+rh)\ov{K_s(n+rh')}W_{r,h,h'}(\frac{n}{N})
\end{equation}
 This time we need to be a bit more careful and decompose the $h,h'$ sum according to the gcd $(h-h',s)$. After applying the Poisson summation formula (cf.~\eqref{eqpoisson}) we can factor the resulting Fourier transform modulo $s$ into sums over prime moduli $q|s$:
$$\widehat{K_s}(y)=\prod_{q|s}\widehat{K_q}(\ov{s_q}y\mods q),\ y\in\mathbf{Z}/s\mathbf{Z},\ s_q=s/q.$$
If $q|h-h'$ we use the trivial bound $\widehat{K_q}(\ov{s_q}y\mods q)\ll q^{1/2}$ and if $q\!\!\not|h-h'$ we use the non-trivial bound $\widehat{K_q}(\ov{s_q}y\mods q)\ll 1$. We eventually obtain (see \cite{Polymath8a})
\begin{theorem} Let $C\geq 1$, let $c$ be squarefree and let $K_c\colon \mathbf{Z}/c\mathbf{Z}\rightarrow\mathbf{C}$ be a product of trace functions $K_q$  such that for any prime $q|c$ the underlying sheaf $\mathcal{F}_q$ is of conductor $\leq C$ , is geometrically irreducible and is not geometrically isomorphic to any polynomial phase of degree $\leq 2$. Then
$$S_V(K_c,N)\ll_{C,\varepsilon} c^{\varepsilon}N^{1/2}(r+s^{1/2})^{1/2}$$
	for any $\varepsilon>0$.
\end{theorem}
If $s$ is not a prime, we could also iterate, factor $s$ into $s=r_2s_2$ and instead of applying the P\'olya-Vinogradov completion method to the sum \eqref{ssum}, we could also apply the $q$-van der Corput method
with the trace functions
$$n\mapsto K_q(n+rh)\ov{K_q(n+rh')},\ q|s_1.$$
This leads us to the quadruple correlation sum
$$\mathcal{C}(K_q,{\mathbf \gamma},\alpha)=\frac{1}q\sum_{x}K_q(\gamma_1\cdot x)K_q(\gamma_2\cdot x)\ov{K_q(\gamma'_1\cdot x)K_q(\gamma'_2\cdot x)}\mathrm{e}_q(\alpha x)$$
where the $\gamma_i,\gamma'_j,\ i,j=i,2$ are unipotent matrices
$$\gamma_i=\begin{pmatrix}1&h_i\\0&1
\end{pmatrix},\ \gamma'_i=\begin{pmatrix}1&h'_j\\0&1
\end{pmatrix}
$$
In suitable situations, we can then apply Theorem \ref{cor-concrete} from the previous section.

An important example is when
$$K_c(n)=\Kl_k(n;c)=\frac{1}{c^{(k-1)/2}}\sum_\stacksum{x_1,\ldots,x_k\in(\mathbf{Z}/c\mathbf{Z})^\times}{x_1.\ldots.x_k=n}e\left(\frac{x_1+\ldots+x_k}{c}\right)$$ is a hyper-Kloosterman sum. For any $q|c$, one has $$K_q(y)=\Kl_k(\ov{c_q}^ky;q)\text{ with }\ c_q=c/q $$ and the underlying sheaf is the multiplicatively shifted Kloosterman sheaf $\mathcal{F}_q=[\times \ov{c_q}^k]^*\mathcal{K}\ell_k$. In that case Theorem \ref{cor-concrete} applies and we eventually obtain the bound
$$S_V(\Kl_k(\cdot;c),N)\ll_k c^{\varepsilon}N^{1/2}\left(r+(N^{1/2}(s_1+s_2^{1/2}))^{1/2}\right)^{1/2}.$$
for any factorisation $c=rs_1s_2$. In particular, if there exists a  factorisation $c=rs_1s_2$ such that
$$r\approx c^{1/4},\ s_1\approx c^{1/4},\ s_2\approx c^{1/2}$$ we obtain
$$S_V(\Kl_k(\cdot;c),N)\ll_k N^{1-\eta}$$
for some $\eta=\eta(\delta)>0$ as long as $$N\geq c^{1/4+\delta}.$$
Iterating once more we see that for any factorisation $c=rs_1s_2s_3$ one has
\begin{equation}\label{vdCiterate3}
S_V(\Kl_k(\cdot;c),N)\ll_{k,\varepsilon} c^{\varepsilon}N^{1/2}\left(r+(N^{1/2}(s_1+(N^{1/2}(s_2+s_3^{1/2}))^{1/2}))^{1/2}\right)^{1/2}
\end{equation}
so if there exists a  factorisation $c=rs_1s_2s_3$ such that
$$r\approx c^{1/5},\ s_1\approx c^{1/5},\ s_2\approx c^{1/5},\ s_3\approx c^{2/5}$$ then
$$S_V(\Kl_k(\cdot;c),N)\ll_{k,\varepsilon} N^{1-\eta}$$
for some $\eta=\eta(\delta)>0$   as long as $$N\geq c^{1/5+\delta}.$$
We can continue this way as long as enough factorisation for $c$ are available. Such availability is garanteed by the notion of friability:
\begin{definition} An integer $c\not=0$ is $\Delta$-friable if $$q|c\ (q\hbox{ prime })\Rightarrow q\leq \Delta.$$
\end{definition}
Using the reasoning above, Irving \cite{IrvingIMRN} proved  the following  result for $k=2$ (in a quantitative form):
\begin{theorem} For any $L\geq 2$ there exists $l=l(L)\geq 1$ and $\eta=\eta(L)>0$ such that for $c$ a squarefree integer which is $c^{1/l}$-friable and any $k\geq 2$, one has,
$$S_V(\Kl_k(\cdot;c),N)\ll_{k,V} N^{1-\eta}$$
whenever $N\geq c^{1/L}$.
\end{theorem}
Therefore one can obtain non-trivial bounds for extremely short sums of hyper-Kloosterman sums as long as their modulus is firable enough. In particular for $k=2$ we have seen in Remark \ref{remselberg} that improving on Selberg's $2/3$-exponent for the distribution of the divisor function in arithmetic progressions to large moduli (Theorem \ref{thmd2}) was essentially equivalent to bounding non-trivially sums of the shape
$$\sumsum_{n_1,n_2}\Kl_2(an_1n_2;c)V(\frac{n_1}{N^*_1})V(\frac{n_2}{N^*_2})$$
for $$N^*_1N^*_2\approx c^{1/2}.$$
If $N^*_1N^*_2\approx c^{1/2}$ then $\mathop{\mathrm{Max}}\limits(N^*_1,N^*_2)\gg c^{1/4}$ and we can use the \eqref{vdCiterate3} to bound non-trivially the above sum granted that $c$ is friable enough. This leads to the following theorem (compare with Theorem \ref{thmd2} for $c$ a prime):
\begin{theorem}{\cite{IrvingIMRN}} There exists $L\geq 4$ and $\eta>0$ such that for any $c\geq 1$ which is squarefree and $c^{1/L}$-friable and any $a$ coprime with $c$, one has for $c\leq X^{2/3+\eta}$ and any $A\geq 0$
$$E(d_2;c,a)\ll_A \frac{X}{c}(\log X)^{-A}.$$
\end{theorem}
See \cite{IrvingIMRN2} and \cite{WuPing} for further applications of these ideas.

\section{Around Zhang's theorem on bounded gaps between primes }

Some of the arguments of the previous chapter can be found in Yitang Zhang's spectacular proof of the existence of bounded gaps between the primes:
\begin{theorem}[\cite{YZhang}]\label{thmZhang} Let $(p_n)_{n\geq 1}$ be the sequence of primes in increasing order ($p_1=2,p_2=3,p_3=5,\ldots$). There exists an absolute constant $C$ such that
$$p_{n+1}-p_n\leq C$$
for infinitely many $n$.
\end{theorem}
Besides Zhang's original paper, we refer to \cite{Gran,KowBBK1} for a detailed description of Zhang's proof and the methods involved and historical background. Let us however mention a few important facts:
\begin{itemize}
\item The question of the existence of small gaps between primes has occupied analytic number theorists for a very long time and has been the motivations for the invention of many techniques, in particular the {\em sieve method} to detect primes with additional constraints. A conceptual breakthrough occurred with the work of Goldston, Pintz and Y\i ld\i r\i m \cite{GYP} who proved the weaker result
$$\liminf_{n}\frac{p_{n+1}-p_n}{\log p_n}=0$$
and who on this occasion invented a technique which is also key to Zhang's approach (see Soundararajan's account of their works \cite{SoundGYP}).
\item Zhang's theorem can be seen as an approximation to the twin prime conjecture:
$$\hbox{\em{There exist infinitely many primes $p$ such that $p+2$ is prime}}.$$
Indeed, Zhang's theorem with $C=2$ is equivalent to the twin prime conjecture.
\item A value for the constant $C$ can be given explicitly : Zhang himself gave
$$C=70.10^6$$
and mentioned that this could certainly be improved. Improving the value of this constant was the objective of the Polymath8 project: following and optimizing Zhang's method in several aspects (some to be explained below), the value was reduced to
$$C=4680.$$
However Maynard \cite{Maynard} made independently another conceptual breakthrough, simplifying the whole proof and making it possible to obtain stronger results and improving the constant to
$$C=600.$$
Eventually the Polymath8 project joined with Maynard ; optimizing his argument, the value
$$C=246$$
 was reached (cf.~\cite{Polymath8b}).

A side-effect of Maynard's approach is that what we are going to describe now plays no role anymore in this specific application. Nevertheless, it adresses another important question in analytic number theory.
\end{itemize}

\subsection{The Bombieri-Vinogradov theorem and beyond}
The breakthrough of Goldston, Pintz and Y\i ld\i r\i m that is at the origin of Zhang's work builds on the use of sieve methods to detect the existence of infinitely many pairs of primes at distance $\leq C$ from one another. The fuel to be put in this sieve machine are results concerning the distribution of primes in arithmetic progressions to moduli large with respect to the size of the primes which are sought after. In this respect the Bombieri-Vinogradov theorem already discussed in \S \ref{Secternary} is a powerful substitute to GRH:
\begin{theorem}[Bombieri-Vinogradov] For any $A>0$ there is $B=B(A)>0$ such that for $x\geq 2$
$$\sum_{q\leq x^{1/2}/\log^B x}\mathop{\mathrm{Max}}\limits_{(a,q)=1}\left|\psi(x;q,a)-\frac{\psi(x;q)}{\varphi(q)}\right|\ll \frac{x}{\log^Ax}.$$
\end{theorem}

For the question of the existence of bounded gaps between primes, the exponent $1/2$ appearing in the constraint $q\leq x^{1/2}/\log^B x$ turns out to be crucial. In their seminal work \cite{GPY}, Goldston-Pintz-Y\i ld\i r\i m had  pointed out that the Bombieri-Vinogradov theorem with the exponent $1/2$ replaced by any strictly larger constant would be sufficient to imply Theorem \ref{thmZhang}.

The possibility of going beyond Bombieri-Vinogradov is not unexpected: the Elliott-Halberstam conjecture predicts that any fixed exponent $<1$ could replace $1/2$. That this conjecture is not wishful thinking comes from the work of Fouvry, Iwaniec and Bombieri-Friedlander-Iwaniec from the 80's \cite{FIActaAr, Fou,BFI} who proved versions of the Bombieri-Vinogradov theorem  with exponents $>1/2$ but for "fixed" congruences classes (for instance with the sum involving the difference $|\psi(x;q,1)-\frac{\psi(x;q)}{\varphi(q)}|$ instead of $\mathop{\mathrm{Max}}\limits_{(a,q)=1}|\psi(x;q,a)-\frac{\psi(x;q)}{\varphi(q)}|$). Zhang's groundbreaking insight has been to nail down a beyond-Bombieri-Vinogradov type theorem that could be established unconditionally and would be sufficient to establish the existence of bounded gaps between primes. The following theorem is a variant of Zhang's  theorem (\cite[Thm 1.1]{Polymath8a}). Let us recall that an integer $q\geq 1$ is $\Delta$-friable if any prime $p$ dividing $q$ is $\leq \Delta$.
\begin{theorem}\label{thmzhang} Let $\uple{a}=(a_p)_{p\in\mathcal{P}}$ be a sequence of integers indexed by the primes such that  $a_p$ is coprime with $p$ for all $p$. For any squarefree integer $q$, let $a_q\mods q$ be the unique congruence class modulo $q$ such that $$\forall p|q,\ a_q\equiv a_p\mods p;$$
 in particular $a_q\in(\mathbf{Z}/ q\mathbf{Z})^\times$.
There exist absolute constants $\theta>1/2$ and $\delta>0$, independent of $\uple{a}$, such that for any $A>0$, $x>2$ one has
$$\sum_\stacksum{q\leq x^{\theta},\ {sqfree}}{q\ x^\delta-{friable}}|\psi(x;q,a_q)-\frac{\psi(x;q)}{\varphi(q)}|\ll \frac{x}{\log^Ax}.$$
Here the implicit constant depends only on $A$, but not on  $\uple{a}$.
\end{theorem}
\begin{remark} Zhang essentially proved this theorem for $\theta=1/2+1/585$ and in an effort to improve Zhang's constant, the Polymath8 project improved $1/585$ to $7/301$.
\end{remark}
We will now describe some of the principles of the proof of this theorem and especially at the points where algebraic exponential sums occur. We refer to the introduction of \cite{Polymath8a} and to E. Kowalski's account in the Bourbaki seminar \cite{KowBBK1}.

Let us write $c(q)$ for $\mu^2(q)$ times the sign of the difference $\psi(x;q,a_q)-\frac{\psi(x;q)}{\varphi(q)}$. The above sum equals
$$\sum_\stacksum{q\leq x^{\theta}}{q\ x^\delta-\hbox{friable}}c(q)\sum_{n\leq x}\Lambda(n)\Delta_{\uple{a}}(n;q).$$
where
$$\Delta_{\uple{a}}(n):=\delta_{n\equiv a_q\mods q}-\frac{\delta_{(n,q)=1}}{\varphi(q)}$$
As is usual when counting primes numbers, the next step is to decompose the von Mangoldt function $\Lambda(n)$ into a sum of convolution of arithmetic functions (for instance by using Heath-Brown's identity Lemma \ref{lemHB} as in \S \ref{Secprimes}): we essentially arrive at the problem of bounding $(\log x)^{O_J(1)}$ of the following model sums (for $j\leq J$ and $J$ is a fixed and large integer)
$$\Sigma(\mathbf{M};\uple{a},Q):=\sum_\stacksum{q\sim Q}{q\ x^\delta-\hbox{friable}}c(q)\sumsum_{m_1,\ldots, m_{2j}}\mu(m_1)\ldots\mu(m_j) V_{1}	\Bigl(\frac{m_{1}}{M_{1}}\Bigr)\ldots V_{2j}	\Bigl(\frac{m_{2j}}{M_{2j}}\Bigr)\Delta_{a_q}(m_1\ldots m_{2j})	$$
where $V_i,\ i=1,\ldots, 2j$ are smooth  functions compactly supported in $]1,2[$ and $\mathbf{M}=(M_1,\ldots,M_{2j})$ is a tuple satisfying
$$Q\leq x^{\theta},\ M_i=:x^{\mu_i},\ \forall i\leq j,\ \mu_i\leq 1/J,\ \sum_{i\leq 2j}{\mu_i}=1+o(1).$$

Our target is the bound
\begin{equation}\label{zhangtarget}
\Sigma(\mathbf{M};\uple{a},Q)
\overset{?}{\ll} \frac{x}{\log^A x}.
\end{equation}
The most important case is when $$Q= x^\theta=x^{1/2+\varpi}$$ for some fixed sufficiently small $\varpi>0$.

The variables with index $j+1\leq \leq 2j$ are called {\em smooth} because they are weighted by smooth functions and this makes it possible to use the Poisson summation formula on them to analyze the congruence condition mod $q$. This is going to be efficient if the range $M_i$ is sufficiently big relatively to $q\sim Q$.  The variables with indices $1\leq i\leq j$ are weighted by the M\"obius function but (at least as long as some strong form of the Generalized Riemann Hypothesis is not available) we cannot exploit this information and we will consider the M\"obius functions like arbitrary bounded functions. The tradeoff to non-smoothness is that the range of these variables is pretty short $M_i\leq x^{1/J}$, especially if $J$ is choosen large.

 As we did before we will aggregate  some of the variables $m_i,\ i=1,\ldots,2j$ so as to form two new variables whose ranges are located adequately (similarly to what we did in \S \ref{Secprimes}) and will use different methods to bound the sums depending on the size and the type of these new variables.

More precisely, we define
$$\alpha_i(m)=\begin{cases}\mu(m)V_{i}	\Bigl(\frac{m}{M_{i}}\Bigr)&\ 1\leq i\leq j\\
V_{i}\Bigl(\frac{m}{M_{i}}\Bigr)&\ j+1\leq i\leq 2j	.
\end{cases}
$$
Given some partition of the set of $m$-indices $$\{1,\ldots,2j\}=\uple{I}\sqcup\uple{J}$$
let
$$M=\prod_{i\in\uple{I}}M_i,\ N=\prod_{j\in\uple{J}}M_j$$
and
$$\mu_\uple{I}:=\sum_{i\in\uple{I}}\mu_i,\ \mu_\uple{J}:=\sum_{i\in\uple{J}}\mu_i.$$
We have $$ \mu_\uple{I}+\mu_\uple{J}=1+o(1),\ M=x^{\mu_{\uple{I}}},\ N=x^{\mu_{\uple{J}}}.$$
In the sequel we will always make the convention that $N\leq M$ or equivalently  $\mu_\uple{I}\geq\mu_\uple{J}$.

Finally we define the Dirichlet convolution functions
$$\alpha(m):=\star_{i\in\uple{I}}\alpha_i(m),\ \beta(n):=\star_{i\in\uple{J}}\alpha_i(n).$$
We are reduced to bound sums of the shape
\begin{equation}\label{partitionsum}
\sum_\stacksum{q\sim Q}{x^\delta-\text {friable}}c(q)\sumsum_\stacksum{m\sim M}{n\sim N}\alpha(m)\beta(n)\Delta_{a_{q}}(mn)
\overset{?}{\ll} \frac{x}{\log^A x}.
\end{equation}

Observe that the functions $\alpha,\beta$ are essentially bounded
$$\forall\varepsilon>0, \alpha(m),\beta(n)\ll x^\varepsilon$$
so we need only to improve slightly over the trivial bound.

\subsection{Splitting into types}
The sums \eqref{partitionsum} will be subdivided into three different types and their treatment will depend on which type the sum belong.

This subdivision follows from the following simple combinatorial Lemma (cf.~\cite[Lem. 3.1]{Polymath8a}):
\begin{lemma} Let $1/10<\sigma<1/2$ and let $\mu_i,\ i=1,\ldots 2j$ be some non-negative real numbers such that
$$\sum_{i=1}^{2j}\mu_i=1.$$
One of the following holds
\begin{itemize}
\item Type 0: there exists $i$ such that $\mu_i\geq 1/2+\sigma$.
\item Type II: there exists a partition $$\{1,\ldots,2j\}=\uple{I}\sqcup\uple{J}$$ such that
$$1/2-\sigma\leq \sum_{i\in\uple{J}}\mu_i\leq \sum_{i\in\uple{I}}\mu_i<1/2+\sigma.$$
\item Type III: there exist distincts $i_1,i_2,i_3$	such that
$$2\sigma\leq \mu_{i_1}\leq \mu_{i_2}\leq \mu_{i_3}\leq 1/2-\sigma\hbox{ and }\mu_{i_1}+\mu_{i_2}\geq 1/2+\sigma.$$
\end{itemize}
\end{lemma}

\begin{remark}\label{remTypeIII} If $\sigma>1/6$ the Type III
situation never occurs since $2\sigma>1/2-\sigma$.
\end{remark}

Given $\sigma$ such that  $$1/10<\sigma<1/2$$
we assume that $J$ is choosen large enough so that
\begin{equation}\label{Jcond}
1/J\leq \min(1/2-\sigma,\sigma).
\end{equation}
We say that a sum \eqref{partitionsum} is of
\begin{itemize}

\item Type 0, if there exists some $i_0$ such that $\mu_{i_0}\geq 1/2+\sigma$. We choose
$$\uple{I}=\{i_0\}\hbox{  and $\uple{J}$ the complement.}$$ Since for any $i\leq j$, one has $\mu_i\leq 1/J<1/2+\sigma$, necessarily $i_0\geq j+1$ corresponds to a smooth variable; the corresponding sum therefore equals
\begin{equation}
\label{type0}\sum_\stacksum{q\sim Q}{x^\delta-\hbox{friable}}c(q)\sumsum_{m\geq 1, n\sim N}V(\frac{m}{M_{i_0}})\beta(n)\Delta_{a_{q}}(mn).
\end{equation}

\item Type I/II if one can partition the set of indices
$$\{1,\ldots,2j\}=\uple{I}\sqcup\uple{J}$$ in a way that the corresponding ranges
$$M=\prod_{i\in\uple{I}}M_i=x^{\mu_\uple{I}}\geq N=\prod_{i\in\uple{J}}M_{i}=x^{\mu_\uple{J}}$$
satisfy
\begin{equation}\label{NcondtypeI}
{1/2-\sigma}\leq \mu_\uple{J}=\sum_{i\in\uple{J}}\mu_{i}\leq {1/2}
\end{equation}

\item Type III if we are neither in the Type 0 or Type I/II situation: there exist distinct indices $i_1,i_2,i_3$	such that
$$2\sigma\leq \mu_{i_1}\leq \mu_{i_2}\leq \mu_{i_3}\leq 1/2-\sigma\hbox{ and }\mu_{i_1}+\mu_{i_2}\geq 1/2+\sigma.$$
We choose
$$\uple{I}=\{i_1,i_2,i_3\}\hbox{  and $\uple{J}$ to be the complement.}$$
Again, since $1/J<2\sigma$ by \eqref{Jcond}, the indices $i_1,i_2,i_3$ are associated to smooth variables and the Type III sums are of the shape
$$\sum_\stacksum{q\sim Q}{x^\delta-\hbox{friable}}c(q)\sumsum_\stacksum{m_1,m_2,m_3}{n\sim N}V(\frac{m_1}{M_{i_1}})
V(\frac{m_2}{M_{i_2}})V(\frac{m_3}{M_{i_3}})\beta(n)\Delta_{a_{q}}(m_1m_2m_3n).$$
\end{itemize}

\begin{remark}In the paper \cite{Polymath8a} the "Type II" sums introduced here were split into two further types that were called "Type I" and "Type II". These are the sums for which the $N$ variable satisfies
\begin{gather*}
\hbox{ Type I: }x^{1/2-\sigma}\leq N< x^{1/2-\varpi-c} \\
\hbox{ Type II: }x^{1/2-\varpi-c}\leq N\leq x^{1/2}
\end{gather*}
for some extra parameter $c$ satisfying
$$1/2-\sigma<1/2-\varpi-c<1/2.$$
This distinction was necessary for optimisation purposes and especially to achieve the exponent $1/2+7/301$ in Theorem \ref{thmzhang}.

\end{remark}

Zhang's Theorem now essentially follows from
\begin{theorem} There exist $\varpi,\sigma>0$ with $1/10<\sigma<1/2$ such that the bound \eqref{partitionsum} holds for the Type 0, II and III sums.
\end{theorem}
For the rest of this section we will succinctly describe how each type of sum is handled.

The case of Type 0 sums \eqref{type0} is immediate: one applies the Poisson summation formula to the $m$ variable to decompose the congruence $mn\equiv a_q\mods q$. The zero frequency contribution is cancelled up to an error term  by the second term of $\Delta_{a_{q}}(mn)$ while the non-zero frequencies contribute a negligible error term as long as the range of the $m$ variable is larger than the modulus, i.e.~
$$1/2+\sigma>1/2+\varpi$$ which can be assumed.

\subsection{Treatment of type II sums}

\subsubsection{The art of applying Cauchy-Schwarz}
The  Type II sums are more complicated to deal with because we have essentially no control on the shape of the coefficients $\alpha(m),\beta(n)$ (except that they are being essentially bounded). The basic principle is to consider the largest variable $m\sim M$, to make it smooth using the Cauchy-Schwarz inequality and then resolve the congruence
$$m\equiv \ov n a_q\mods q$$
using the Poisson summation formula. This is the essence of the {\em dispersion method} of Linnik.

When implementing this strategy one has to decide which variables to put "inside" the Cauchy-Schwarz inequality and which to leave "outside". To be more specific, suppose we need to bound a general trilinear sum
$$\sumsum_{m\sim M,n\sim N}\sum_{q\sim Q}\alpha_m\beta_n\gamma_q K(m,n,q)$$
and wish to smooth the $m$ variable using Cauchy-Schwarz. There are two possibilities, either
$$
\sumsum_{m\sim M,n\sim N}\sum_{q\sim Q}\alpha_m\beta_n\gamma_q K(m,n,q)\ll \|\alpha\|_2\|\gamma\|_2\biggl(\sumsum_{m\sim M,q\sim Q}|\sum_{n\sim N}\beta_n K(m,n,q)|^2\biggr)^{1/2}$$
or
$$
\sumsum_{m\sim M,n\sim N}\sum_{q\sim Q}\alpha_m\beta_n\gamma_q K(m,n,q)\ll \|\alpha\|_2\biggl(\sum_{m\sim M}|\sumsum_{n\sim N,q\sim Q}\beta_n\gamma_q K(m,n,q)|^2\biggr)^{1/2}	$$

In the first case the inner sum of the second factor equals
$$\sumsum_{n_1,n_2\sim N}\beta_{n_1}\ov{\beta_{n_2}}\sumsum_{m\sim M,q\sim Q} K(m,n_1,q)\ov{K(m,n_2,q)}
$$
and in the second case
$$\sumsum_{n_1,n_2\sim N}\sumsum_{q_1,q_2\sim Q}\beta_{n_1}\gamma_{q_1}\ov{\beta_{n_2}\gamma_{q_2}}\sum_{m\sim M} K(m,n_1,q_1)\ov{K(m,n_2,q_2)}.$$

In either case, one expects to be able to detect cancellation from the $m$-sum, at least when the other variables $(n_1,n_2)$ or $(n_1,n_2,q_1,q_2)$
are not located on the diagonal (i.e.~$n_1=n_2$ or $n_1=n_2,\ q_1=q_2$). If the other variables are on the diagonal, no cancellation is possible but the diagonal is small compared to the space of variables.

We are faced with the following trade-off:
\begin{itemize}

\item For the first possibility, the $m$-sum is simpler (it involves three parameters $n_1,n_2,q$) but the ratio "size of the diagonal"$/$"size of the set of parameters" is  $N/N^2=N^{-1}$.
\item For the second possibility, the $m$-sum is more complicated as it involves more auxiliary parameters $n_1,n_2,q_1,q_2$ but the ratio "size of the diagonal"$/$"size of the set of parameters" $NQ/N^2Q^2=1/NQ$ is smaller (hence more saving can be obtained from the diagonal part).
\end{itemize}

\subsubsection{The Type II sums}

We illustrate this discussion in the case of Type II sums. If we apply Cauchy with the $q$ variable outside the diagonal $n_1=n_2$ would not provide enough saving. If, on the other hand, we apply Cauchy with $q$ inside, then the diagonal is large but we have to analyze the congruence
$$mn_1\equiv a\mods{q_1},\ mn_2\equiv a\mods{q_2}$$
which is a congruence modulo $[q_1,q_2]$. Assuming we are in the generic case of $q_1,q_2$ coprime, the resulting modulus is $q_1q_2\sim Q^2=x^{1+2\varpi}$ while $m\sim M\leq x^{1/2}$, which is too small for the Poisson formula to be efficient.

There is fortunately a middle-ground: we can use the extra flexibility (due to Zhang's wonderful insight) that our problem involves {\em friable} moduli: by the greedy algorithm, one can factor  $q\sim Q$ into a product $q=rs$ where $r$ and $s\sim Q/r$ vary over ranges that we can essentially choose as we wish (up to a small  indeterminacy of $x^\delta$ for $\delta$ small). In other words, we are reduced to bounding sums of the shape
$$\Sigma(M,N;\uple{a},R,S)=\sumsum_\stacksum{r\sim R,\ s\sim S}{rs\ x^\delta-\hbox{friable}}c(rs)\sumsum_\stacksum{m\sim M}{n\sim N}\alpha(m)\beta(n)\Delta_{a_{rs}}(mn)$$
for any factorisation $RS=Q$ that fits with our needs. Now, when applying Cauchy-Schwarz, we have the extra flexibility of having the $r$ variable "out" and the $s$ variable "in".

 We do this and get
\begin{multline*}
\sumsum_{r\sim R,s\sim S}c(rs)\sumsum_\stacksum{m\sim M}{n\sim N}\alpha(m)\beta(n)\Delta_{a_{rs}}(mn)=\sum_{r\sim R}\sum_{m\sim M}\alpha(m)\sum_sc(rs)\sum_{n\sim N}\beta(n)\Delta_{a_{rs}}(mn)\\
\ll_\varepsilon R^{1/2}M^{1/2+\varepsilon}\biggl(\sum_r\sumsum_{s_1,s_2,n_1,n_2}c(rs_1)\ov{c(rs_2)}\beta(n_1)\ov{\beta(n_2)}\sum_{m}V(\frac{m}M)\Delta_{a_{rs_1}}(mn_1)\Delta_{a_{rs_2}}(mn_2)\biggr)^{1/2}
\end{multline*}
for $V$ a smooth function compactly supported in $[M/4,4M]$. We choose $R$ of the shape $$R=Nx^{-\varepsilon}\leq Mx^{-\varepsilon}$$
for $\varepsilon>0$ but small.

Expanding the square, we obtain a sum involving four terms. The most important one comes from the product
\begin{equation}\label{Deltaproduct}
\Delta_{a_{rs_1}}(mn_1)\Delta_{a_{rs_2}}(mn_2)=(\delta_{mn_1\equiv a_{rs_1}\mods{rs_1}}-\frac{\delta_{(n,rs_1)=1}}{\varphi(rs_1)})(\delta_{mn_2\equiv a_{rs_2}\mods {rs_2}}-\frac{\delta_{(n,rs_2)=1}}{\varphi(rs_2)})	.
\end{equation}
We will concentrate on the contribution of this term from now on.

The generic and main case is when $(s_1,s_2)=1$, so that $m$ satisfies a congruence modulo $rs_1s_2\sim RS^2=Mx^{2\varpi+\varepsilon}$ which is not much larger than $M$ if $\varpi$ is small. Observe that
$$mn_i\equiv a_{rs_i}\mods{rs_i},\ i=1,2\Longrightarrow \ n_1\equiv n_2\mods r.$$
We can therefore write $n_1=n,\ n_2=n+rl$ with $|l|\ll N/R=x^{\varepsilon}$.
By the Poisson summation formula, we have
$$\sum_{m}V(\frac{m}M)\delta_{m\equiv b\mods{rs_1s_2}}=\frac{M}{rs_1s_2}\widehat V(0)+\frac{M}{rs_1s_2}\sum_{h\not=0}\widehat V(\frac{h}{rs_1s_2/M})e\left(\frac{hb}{rs_1s_2}\right)$$
where $b=b(n,l)\mods {rs_1s_2}$ is such that
$$b\equiv a_{rs_1s_2}\ov n\mods r,\ b\equiv a_{rs_1s_2}\ov n\mods{s_1}, b\equiv a_{rs_1s_2}\ov{n+lr}\mods{s_2}.$$
The $h=0$ contribution provides a main term which is cancelled up to an admissible error term by the main contributions coming from the other summands of \eqref{Deltaproduct}. The contribution of the frequencies $h\not=0$ will turn out to be error terms. We have to show that
$$\sum_r\sumsum_{s_1,s_2,n,l}c(rs_1)\ov{c(rs_2)}\beta(n)\ov{\beta(n+rl)}\frac{M}{rs_1s_2}\sum_{h\not=0}\widehat V(\frac{h}{rs_1s_2/M})e\left(\frac{hb}{rs_1s_2}\right){\ll} \frac{MN^2}Rx^{-\eta}=x^{1-\eta+\varepsilon}$$
for some fixed $\eta>0.$
 The length of the $h$ sum is essentially
$$H=RS^2/M=Q^2N/(xR)=x^{2\varpi+\varepsilon}$$
which is small (if $\varpi$ and $\varepsilon$ are). We therefore essentially need to prove that
\begin{multline}\label{TypeIIinter}\frac{1}{H}\sum_{r\sim R}\sum_{l\ll N/R}\sum_{n}\beta(n)\ov{\beta(n+lr)}\sum_{0\not=h\ll H}\left|\sum_{s_1,s_2}c(rs_1)\ov{c(rs_2)}e\left(h\frac{a_{rs_1s_2}\ov n}{rs_1}+h\frac{a_{rs_1s_2}\ov{n+lr}}{rs_2}\right)\right|\\
{\ll}x^{1-\eta+\varepsilon}.
\end{multline}

We can now exhibit cancellation in the $n$-sum by smoothing out the $n$ variable using the Cauchy-Schwarz inequality for any fixed $r,l$: letting the $h$ variable "in" we obtain exponential sums of the shape

$$\sum_{n\sim N}e\left(h\frac{a_{rs_1s_2}\ov n}{rs_1}-h'\frac{a_{rs'_1s'_2}\ov n}{rs'_1}+h\frac{a_{rs_1s_2}\ov{n+lr}}{rs_2}-
h'\frac{a_{rs'_1s'_2}\ov{n+lr}}{rs'_2}\right).$$

The generic case is when $h-h',s_1,s_2,s'_1,s'_2$ are all coprime. In that case
the above exponential sum has length $$N\in[x^{1/2-\sigma},x^{1/2}]$$ and the moduli involved are of size $$RS^4=Q^4/R^3=x^{O(\varepsilon)}Q^4/N^3=[x^{1/2+4\varpi+O(\varepsilon)},x^{1/2++4\varpi+3\sigma+O(\varepsilon)}].$$
Therefore if $\sigma,\varpi,\varepsilon$ are small, the length $N$ is not much smaller than the modulus so we could apply the completion method to improve over the trivial bound $O(N)$ for the $n$-sum. If we apply the P\'olya-Vinogradov method, the trivial bound is replaced by $O((RS^4)^{1/2+o(1)})$  and we find that  the left-hand side of \eqref{TypeIIinter} is bounded by
$$\frac{1}HR.\frac{N}RN^{1/2}(H^2S^4(RS^4)^{1/2+o(1)})^{1/2}=x^{O(\varepsilon)+o(1)}N^{3/2}S^3R^{1/4}=x^{\frac{7}8+3\varpi+\frac{5}4\sigma+O(\varepsilon)+o(1)}$$
which is $\ll x^{1-\eta}$ for some $\eta>0$ whenever $\sigma<1/10$ and $\varpi$ and $\varepsilon$ are small enough.

Instead of using the P\'olya-Vinogradov bound, we could take advantage of the fact that the modulus $rs_1s'_1s_2s'_2$ is $x^\delta$-friable (again we can take $\delta>0$ as small as we need) and apply the $q$-van der Corput method from the previous section. Factoring $rs_1s'_1s_2s'_2$ into a product $r's'$ such that $r'\sim (rs_1s'_1s_2s'_2)^{1/3+O(\delta)}$, $s'\sim (rs_1s'_1s_2s'_2)^{2/3+O(\delta)}$, a suitable variant of
\eqref{optimalvdC} bounds the $n$-sum by $O(N^{1/2}(RS^4)^{1/6+O(\delta)+o(1)})$ and the
left-hand side of \eqref{TypeIIinter} is bounded by
$$\frac{R}H\frac{N}RN^{\frac{1}2}(H^2S^4N^{1/2}(RS^4)^{1/6})^{\frac{1}2+o(1)+O(\delta)}=x^{O(\varepsilon+\delta)+o(1)}N^{7/4}S^{7/3}R^{1/12}=x^{\frac{11}{12}+\frac73\varpi+\frac{1}2\sigma+O(\varepsilon+\delta)+o(1)}$$
which is $\ll x^{1-\eta}$ for some $\eta>0$ whenever $\sigma<1/6$ and $\varpi$ and $\varepsilon$ are small enough.

\subsection{Treatment of type III sums}
Our objective for the Type III sums is the following bound: for some $\eta>0$, we have
\begin{equation}\label{typeIIIgoal}
\sum_\stacksum{q\sim Q}{x^\delta-\hbox{friable}}c(q)\sum_{n\sim N}\beta(n)\sum_{m}\tau_{3,\mathbf{M}}(m)\Delta_{a_{q}}(m_1m_2m_3n){\ll}x^{1-\eta},
\end{equation}
where $\mathbf{M}=(M_{i_1},M_{i_2},M_{i_3})$ and
$$\tau_{3,\mathbf{M}}(m):=\sum_{m_1m_2m_3=m}V(\frac{m_1}{M_{i_1}})
V(\frac{m_2}{M_{i_2}})V(\frac{m_3}{M_{i_3}})$$
and $M_{i_1},M_{i_2},M_{i_3}$ satisfy
$$M=M_{i_1}M_{i_2}M_{i_3}\geq x^{1/2+3\sigma}.$$

The function
$$m\mapsto \tau_{3,\mathbf{M}}(m)$$
is basically a smoothed version of the ternary divisor function $m\mapsto \tau_3(m)$ that we have discussed in \S \ref{Secternary}.

In fact, while describing the proof of Theorem \ref{thmd3}, we have shown that for $M=x$, and for $q$ a prime satisfying
$$q\sim x^{1/2+\varpi},\ \varpi=1/47$$ one has
$$ \sum_{m}\tau_{3,\mathbf{M}}(m)\Delta_{a_{q}}(m_1m_2m_3n)\ll \frac{x^{1-\eta}}q$$ for some $\eta>0$. We have therefore the required bound but for individual moduli instead of having it on average.

As we have observed when discussing Type II sums, the parameter $\sigma$ can be taken as close to $1/6$ as we wish and in particular
 $M\in [x^{1+3(\sigma-\frac16)},x]$ can be made as close as we wish from $x$ and $N\in [1,x^{3(\frac16-\sigma)}]$ as we wish from $x$ (in the logarithmic scale). In particular, this establishes  \eqref{typeIIIgoal} for prime moduli $q\sim Q$ for some value of $\sigma$ (close enough to $1/6$), and some value of $\varpi$ (close enough to $0$) and some $\eta>0$.

 The case of $x^\delta$-friable moduli uses similar methods and (besides some elementary technical issues) is maybe simpler than in the prime modulus case because of the extra flexibility provided by the friable moduli.

\begin{remark} By a more elaborate treatment, involving different uses of the Cauchy-Schwarz inequality and iterations of the $q$-van der Corput method, it is possible to bounds successfully all the Type II sums associated to some explicit parameter $\sigma>1/6$. As pointed out in Remark \ref{remTypeIII}, this makes the section devoted to Type III sums (and in particular the theory of hyper-Kloosterman sums $\Kl_3(x;q)$) unnecessary. The interest of this remark comes from the fact that the trace functions occurring in the treatment of the sums of Type II are exclusively algebraic exponentials:
$$x\mapsto \mathrm{e}_q({f(x)}),\ \hbox{for }f(X)\in{\mathbf{F}_q}(X).$$
For such trace functions, Corollary \ref{delignecor} "only" uses Weil's resolution of the Riemann Hypothesis for curves over finite fields \cite{Weil0} and not the full proof of the Weil conjectures by Deligne \cite{WeilII}.
\end{remark}

\section{Advanced completions methods: the  $+ab$ shift}
In this last section, we describe another method allowing to break the P\'olya-Vinogradov barrier for prime moduli. This method has its origins in the celebrated work of Burgess on short sums of Dirichlet characters \cite{Bur}.

\subsection{Burgess's bound}\label{Bursec}

Let $q$ be a prime and le $\chi\colon {\mathbf{F}^\times_q}\rightarrow\mathbf{C}^\times$ be a non trivial multiplicative character. Consider the sum
$$S_V(\chi,N):=\sum_{n}\chi(n)V(\frac nN)$$
where $V\in\mathcal{C}^\infty(]1,2[)$.

\begin{theorem}[Burgess]\label{Burgessbound} For any $N\geq 1$ and $l\geq 1$ such that
\begin{equation}\label{Burgesscond}
q^{1/2l}\leq N< \frac12q^{1/2+1/4l}
\end{equation}
we have
$$S_V(\chi,N)\ll_{V,l}q^{o(1)}N(N/q^{1/4+1/4l})^{-1/l}.$$
\end{theorem}
\begin{remark} Observe that this bound is non-trivial (sharper than $S_V(\chi,N)\ll N$) whenever
$$q^{1/4+1/4l+o(1)}\leq N< \frac12q^{1/2+1/4l}.$$
Moreover, for $N\geq  \frac12q^{1/2+1/4l}$, the P\'olya-Vinogradov bound $S_V(\chi,N)\ll q^{1/2}$ is non trivial, therefore, we see that by taking $l$ large enough, that \eqref{Burgessbound} yields a non-trivial bound for $S_V(\chi,N)$ as long as $$N\geq q^{1/4+\delta}$$  for some fixed $\delta>0$.
\end{remark}

\proof
Burgess's argument exploits two features in a critical way: the first one is that an interval is "essentially" invariant under sufficiently small additive translations and the second is the multiplicativity of the Dirichlet character.

Let $A,B\geq 1$ be parameters such that
$AB\leq N/2$; we will also assume that $2B<q$.

We have
$$S_V(\chi,N)=\frac{1}{AB}\sum_{|n|\leq 2N}\sumsum_{a\sim A,b\sim B}\chi(n+ab)V(\frac{n+ab}N).$$
The next step is to invoke the Fourier inversion formula to separate the variables $n$ and $ab$: one has
$$V(\frac{n+ab}N)=\int_\mathbf{R}\widehat V(t)e(\frac{tn}N)e(\frac{tab}N)dt.$$
Plugging this formula in our sum, we obtain
\begin{align*}
S_V(\chi,N)
&=\frac{1}{AB}\int_\mathbf{R}\sum_{|n|\leq 2N}e(\frac{tn}N)\sumsum_{a\sim A,b\sim B}\chi(n+ab)e(\frac{tab}N)\widehat V(t)dt	\\
&\leq  \frac{1}{AB}\int_\mathbf{R}\sum_{|n|\leq 2N}\sum_{a\sim A}\bigl|\frac{\chi(a)}{a}\widehat V(\frac{t}a)\bigr|\bigl|\sum_{b\sim B}\chi(\ov an+b)e(\frac{tb}N)\bigr|
dt\\
&\leq \frac{1}{AB}\int_\mathbf{R} \sum_{|n|\leq 2N}\sum_{a\sim A}\bigl|\sum_{b\sim B}\chi(\ov an+b)e(\frac{tAb}N)\bigr||W(t)|dt
\end{align*}
for $W$ some bounded rapidly decaying function.
\begin{remark}\label{remchi}
	Observe that the factor $\chi(a)$ coming from the identity
\begin{equation}\label{chimult}
\chi(n+ab)=\chi(a(\ov an+b))=\chi(a)\chi(\ov an+b)
\end{equation}
has been absorbed in the absolute value of the first inequality above.
\end{remark}

The innermost sum can be rewritten
$$\sum_{|n|\leq 2N}\sum_{a\sim A}\bigl|\sum_{b\sim B}\chi(\ov an+b)e(\frac{tAb}N)\bigr|=\sum_{r\in{\mathbf{F}^\times_q}}\nu(x)|\sum_{b\sim B}\eta_b\chi(r+b)\bigr|$$
where $\eta_b=e(\frac{tAb}N)$ and
$$\nu(r):=|\{(a,n)\in[A,2A[\times[-2N,2N],\ \ov an=r\mods q\}|.$$
Consider the map
$$(a,n)\in[A,2A[\times[-2N,2N]\mapsto \ov an\mods q=r\in {\mathbf{F}_q}.$$
The function $\nu(r)$ is the size of the fiber of that map above $r$. We will show that this map is "essentially injective" (has small fibers on average). Suppose that $A$ is chosen such that
$4AN<q;$ then one has
$$\sum_r\nu(r)\ll AN,\ \sum_r\nu^2(r)\ll (AN)^{1+o(1)}$$
where the first bound is obvious while for the second we observe that
$$\sum_r\nu^2(r)=|\{(a,a',n,n'), \ a,a'\in[A,2A[,\ |n|,|n'|\ll N,\ an'\equiv an\mods q\}|,$$
then use the fact that $AN<q$ and that the integer $an'$ has at most $(an')^{o(1)}$ decomposition of the shape $an'=a'n$.

This map however is not surjective nor even close to being so in general, so that the change of variable $\ov a.n\leftrightarrow x$ is not very effective. A way to moderate ineffectiveness is to use H\"older's inequality.

Let $l\geq 1$ be some integer parameter. Applying H\"older's inequality with $1/p=1-1/2l,\ 1/q=1/2l$ and the above estimate one obtains
\begin{align*}
\sum_{x\in{\mathbf{F}^\times_q}}\nu(x)|\sum_{b\sim B}\eta_b\chi(x+b)\bigr|&\leq  	(\sum_x\nu(x)^{\frac{2l}{2l-1}})^{1-1/2l}(\sum_x
|\sum_{b\sim B}\eta_b\chi(x+b)\bigr|^{2l})^{1/2l}\\
&\ll (AN)^{1-1/2l+o(1)}(\sum_x
|\sum_{b\sim B}\eta_b\chi(x+b)\bigr|^{2l})^{1/2l}.
\end{align*}
The $x$-sum in the rightmost factor equals
$$\sum_{\uple{b}}\eta_\uple{b}\sum_{r\in{\mathbf{F}_q}}\chi(\frac{\prod_{i=1}^l(r+b_i)}{\prod_{i=i}^l(r+b_{k+i})})$$
where
$\uple{b}=(b_1,\ldots,b_{2l})\in[B,2B[^{2l}$ and $\eta_\uple{b}=\prod_{i=1}^{2l}\eta_{b_i}$. Consider the fraction
$$F_\uple{b}(X):=\frac{\prod_{i=1}^l(X+b_i)}{\prod_{i=i}^l(X+b_{k+i})}\in \mathbf{Q}(X)$$
and the function on ${\mathbf{F}_q}$
$$r\in{\mathbf{F}_q}\mapsto \chi(F_\uple{b}(r))$$
(extended by $0$  for $r=-b_i\mods q,\ i=1,\ldots,2l$). This function is the trace function of the rank one sheaf $[F_\uple{b}]^*\mathcal{L}_\chi$ whose conductor is bounded in terms of $l$ only and (because it is of rank $1$) which is geometrically irreducible if not-geometrically constant. If not geometrically constant one has\footnote{It is not necessary to invoke Deligne's main theorem here: this follows from A. Weil's proof of the Riemann hypothesis for curves \cite{Weil0}.}
$$\sum_{r\in{\mathbf{F}_q}}\chi(F_\uple{b}(r))\ll_lq^{1/2}.$$
If $q>\mathop{\mathrm{Max}}\limits(l,2B)$ this occurs precisely when $F_\uple{b}(X)$ is not constant nor a $k$-th power, where $k$ is the order of $\chi$. Hence this holds for $\uple{b}$ outside an explicit set $\mathcal{B}^{bad}\subset [B,2B[^{2l}$ of size bounded by $O(B^{l})$. If $\uple{b}\in \mathcal{B}^{bad}$, we use the triv,ial bound
$$|\sum_{r\in{\mathbf{F}_q}}\chi(F_\uple{b}(r))|\leq q.$$
All in all, we eventually obtain
$$\sum_{\uple{b}}\eta_\uple{b}\sum_{x}\chi\left(\frac{\prod_{i=1}^l(x+b_i)}{\prod_{i=i}^l(x+b_{k+i})}\right)\ll |\mathcal{B}^{bad}|q+|\mathcal{B}-\mathcal{B}^{bad}|q^{1/2}\ll B^lq+B^{2l}q^{1/2}.$$
Choosing $B=q^{1/2l}$ (so as to equal the two terms in the bound above) and $A\approx Nq^{-1/2l}$  with the condition $4AN<q$, which is equivalent to \eqref{Burgesscond}, we obtain that
$$S_V(\chi,N)\ll_l \frac{q^{o(1)}}{AB}(AN)^{1-1/2l}(q^{3/2})^{1/2l}\ll q^{o(1)}N^{1-1/{l}}q^{3/4l-(1-1/2l)/2l}=q^{o(1)}N(N/q^{1/4+1/4l})^{-1/l}.$$
\qed

\subsection{The $+ab$-shift for type I sums}
It is natural to try to extend this method to other trace functions; unfortunately the above argument breaks down because the identity \eqref{chimult} is not valid in general. It is however possible to mitigate this problem by introducing an extra average.

This technique goes back to Karatsuba and Vinogradov (for the function $x\mapsto \chi(x+1)$). It has been also used by Friedlander-Iwaniec \cite{FrIw} (for the function $x\mapsto e\left(\frac{\ov x}q\right)$), Fouvry-Michel \cite{FoMi} and Kowalski-Michel-Sawin \cite{KMS,KMS2}.

 Instead of a single sum $S_V(K,N)$, one considers the following average of multiplicative shifts
 $$B_V(K,\uple{\alpha},N):=\sum_{m\sim M}\alpha_m\sum_n V(\frac{n}{N})K(mn)$$
 where $1\leq M<q$ and $(\alpha_m)_{m\sim M}$ is a sequence of complex numbers of modulus $\leq 1$ (this includes the averaged sum
 $\sum_{m\sim M}\bigl|\sum_nK(mn)V(\frac{n}{N})\bigr|=\sum_m|S_V([\times m]^*K,N)|$). The
  objective here is to improve over the trivial bound
 $$B_V(K,\uple{\alpha},N)\ll \|K\|_\infty MN.$$

 Proceeding as above we have
\begin{align*}
B_V(K,\uple{\alpha},N)&=\frac{1}{AB}\sum_{m}\alpha_m\sum_{n}\sumsum_{a\sim A,b\sim B}K(m(n+ab))V(\frac{n+ab}N)\\
&\leq \frac{1}{AB}\int_\mathbf{R} \sum_{m\sim M}\alpha_m\sum_{|n|\leq 2N}\sum_{a\sim A}\bigl|\sum_{b\sim B}K(am(\ov an+b))e(\frac{tAb}N)\bigr||W(t)|dt.
\end{align*}
We have
$$\sum_{m\sim M}\alpha_m\sum_{|n|\leq 2N}\sum_{a\sim A}\bigl|\sum_{b\sim B}K(am(\ov an+b))e(\frac{tAb}N)\bigr|=\sumsum_{r,s\in{\mathbf{F}_q}}\nu(r,s)\bigl|\sum_{b\sim B}\eta_b K(s(r+b))\bigr|$$
with
$$\nu(r,s)=\sum_{m\sim M}\sum_{|n|\leq 2N}\sum_{a\sim A}\alpha_m\delta_{\ov an=r,am=s\mods q}.$$
Assuming that $4AN<q$ and evaluating the number of solutions to the equations
$$am=a'm',\ a\ov n\equiv a'\ov n'\mods q,\ (a,m,n)\in[A,2A[\times[M,2M[\times[N,2N[$$
one finds that
$$\sumsum_{r,s\in{\mathbf{F}_q}}|\nu(r,s)|\ll AMN,\ \sumsum_{r,s\in{\mathbf{F}_q}}|\nu(r,s)|^2\ll q^{o(1)}AMN$$
which we interpret as saying that the map
$$(a,m,n)\in[A,2A[\times[M,2M[\times[N,2N[\rightarrow (r,s)=(\ov a.n,am)\in {\mathbf{F}_q}\times [AM,4AM[$$ is essentially injective (i.e.~has small fibers on average). As before, this map is far from being surjective but one can dampen this with H\"older's inequality:
$$\sumsum_\stacksum{r\in{\mathbf{F}_q}}{1\leq s\leq 4AM}\nu(r,s)\bigl|\sum_{b\sim B}\eta_b K(s(r+b))\bigr|\ll \big(\sumsum_{r,s}|\nu(r,s)|^{\frac{2l}{2l-1}}\big)^{1-1/2l}\big(\sumsum_{r,s}\bigl|\sum_{b\sim B}\eta_b K(s(r+b))\bigr|^{2l}\big)^{1/2l}$$
$$\ll q^{o(1)}(AMN)^{1-1/2l}\bigl(\sum_{\uple{b}}\eta_{\uple{b}}\sum_{r,s}\prod_{i=1}^lK(s(r+b_i))\ov{K(s(r+b_{i+l}))}\bigr)^{1/2l}.$$
We are now reduced to the problem of bounding the two variable sum
\begin{equation}\label{generalKVsum}
\sum_{r,s}\prod_{i=1}^lK(s(r+b_i))\ov{K(s(r+b_{i+l}))}=\sum_r\sum_{s}\mathbf{K}(sr,s\uple{b})=\sum_{r}\mathbf{R}(r,\uple{b})
\end{equation}
(say) where
\begin{equation}\label{KRdef}
\mathbf{K}(r,\uple{b}):=\prod_{i=1}^lK(r+b_i)\ov{K(r+b_{i+l})},\ \mathbf{R}(r,\uple{b})=\sum_{s}\mathbf{K}(sr,s\uple{b}).
\end{equation}

The bound will depend on the vector $\uple{b}\in[B,2B[^{2l}$.
To get a feeling of what is going on, let us consider one of cases treated in \cite{FoMi}: let
$$K(x)=\mathrm{e}_q(\ov x+x).$$
We have
$$\mathbf{R}(sr,s\uple{b})=\sum_{s\in{\mathbf{F}^\times_q}}\mathrm{e}_q(\ov s\sum_{i=1}^l(\ov{r+b_i}-\ov{r+b_{i+l}})+s\sum_{i=1}^l({b_i}-{b_{i+l}})).$$
This sum is either
\begin{enumerate}
\item Equal to $q-1$, if and only if the vector $(b_1,\ldots, b_l)$ equals the vector $(b_{l+1},\ldots, b_{2l})$ up to permutation of the entries.
\item Equal to $-1$ if $\uple{b}$ is not as in (1) but is in the hyperplane with equation $\sum_{i=1}^l({b_i}-{b_{i+l}})=0$.
\item The Kloosterman sum $$\mathbf{R}(r,\uple{b})=q^{1/2}\Kl_2\left(\frac{\sum_{i=1}^l(\ov{r+b_i}-\ov{r+b_{i+l}})}{\sum_{i=1}^l({b_i}-{b_{i+l}})};q\right)$$
otherwise.
\end{enumerate}
The last case is the most interesting. Given $\uple{b}$ as in the last situation, we have to evaluate
$$q^{1/2}\sum_r\Kl_2(G_\uple{b}(r);q)$$
where
\begin{equation}\label{Gbdef}
G_\uple{b}(X)=\frac{\sum_{i=1}^l(\ov{X+b_i}-\ov{X+b_{i+l}})}{\sum_{i=1}^l({b_i}-{b_{i+l}})}.
\end{equation}
\begin{lemma}For $\uple{b}=(b_1,\ldots,b_{2l})\in{\mathbf{F}_q}^{2l}$ such that
\begin{equation}\label{bcond} (b_1,\ldots, b_l)\hbox{ is not equal to }(b_{l+1},\ldots, b_{2l}) \hbox{ up to permutation and }\sum_{i=1}^l({b_i}-{b_{i+l}})\not=0,
\end{equation}
 one has
	$$\sum_r\Kl_2(G_\uple{b}(r);q)\ll_l q^{1/2}.$$
\end{lemma}
\proof
The function
$$r\mapsto \Kl_2(G_\uple{b}(r);q)$$
is the trace function of the rank $2$ sheaf $[G_\uple{b}]^*\mathcal{K}\ell_2$ obtained by pull-back from the Kloosterman sheaf $\mathcal{K}\ell_2$ of morphism
$$x\mapsto G_\uple{b}(x)$$
which is non-constant by assumption.

Moreover, one can show that he conductor of $[G_\uple{b}]^*\mathcal{K}\ell_2$ is bounded in terms of $l$ only, and  moreover the geometric monodromy group of $[G_\uple{b}]^*\mathcal{K}\ell_2$ is obtained as the (closure of the) image of the representation $\rho_{\mathcal{K}\ell_2}$ restricted to a finite index subgroup of $\Gal(K^{\mathrm{sep}}/\ov{{\mathbf{F}_q}}.K)$. Since the geometric monodromy group of $\mathcal{K}\ell_2$ is $\SL_2$ which has no finite index subgroup, the geometric monodromy group of $[G_\uple{b}]^*\mathcal{K}\ell_2$ is $\SL_2$ as well. It follows that the sheaf $[G_\uple{b}]^*\mathcal{K}\ell_2$ is geometrically irreducible (and not geometrically trivial because of rank $2$) and the estimate follows by Deligne's theorem.
\qed

It follows from this analysis that
$$\sumsum_{r,s}\bigl|\sum_{b\sim B}\eta_b K(s(r+b))\bigr|^{2l}\ll B^{l}q^{2}+B^{2l}q,$$
hence choosing $B=q^{1/l}$, $AB\approx N$ and $A\approx Nq^{-1/l}$ we obtain
$$B_V(K,\uple{\alpha},N)\ll\frac{q^{o(1)}}{AB}(AMN)^{1-1/2l}q^{3/2l}=q^{o(1)}MN(\frac{N^2M}{q^{1+1/l}})^{-1/2l}.$$
To resume we have therefore proven the
\begin{theorem} Let $K(x)=\mathrm{e}_q(\ov x+x)$ and $M,N,l\geq 1$ and $(\alpha_m)_{m\sim M}$ be a sequence of complex numbers of modulus bounded by $1$. Assuming that
$$q^{1/l}\leq N<\frac12 q^{1/2+1/2l}$$ we have
$$\sum_{m\sim M}\alpha_m\sum_{n}V(\frac{n}N)K(mn)\ll q^{o(1)}MN(\frac{N^2M}{q^{1+1/l}})^{-1/2l}.$$
\end{theorem}

This bound is non trivial (sharper than $\ll MN$) as long as\footnote{If $N\geq \frac12 q^{1/2+1/2l}$ the P\'olya-Vinogradov inequality is non trivial already.}
$$N^2M\geq q^{1+1/l}.$$
For instance, if $M=q^\delta$ for some $\delta>0$,  the above bound is nontrivial for $l$ large enough and $N\geq q^{1/2+\delta/3}$. Alternatively if $M=N$,  this bound is non trivial as long as
$$N=M\geq q^{1/3+\delta}$$ if $l$ is taken large enough. Therefore this method improves the range of non-triviality in Theorem \ref{thmbilinear}.

\subsection{The $+ab$-shift for type II sums}
With this method, it is also possible to deal with the more general (type II) bilinear sums
$$B(K,\uple{\alpha},\uple{\beta})=\sumsum_{m\sim M,n\sim N}\alpha_m\beta_n K(mn)$$
where $(\alpha_m)_{m\sim M}$, $(\beta_n)_{n\sim N}$ are sequences of complex numbers of modulus bounded by $1$.

We leave it to the interested reader to fill in the details (or to look at \cite{FoMi,KMS} or \cite{KMS2}). The first step is to apply Cauchy-Schwarz to smooth out the $n$ variable: for a suitable smooth function $V$, compactly supported in $[1/2,5/2]$ and bounded by $1$, one has
$$\bigl|\sumsum_{m\sim M,n\sim N}\alpha_m\beta_n K(mn)\bigr|\leq N^{1/2}\bigl(\sumsum_{m_1,m_2\sim M}\alpha_{m_1}\ov{\alpha_{m_2}}\sum_{n}V(\frac{n}N)K(m_1n)\ov{K(m_2n)}\bigr)^{1/2}.$$
The next step is to perform the $+ab$-shift on the $n$ variable and to make the change of variables
$$(a,m_1,m_2,n)\in[A,2A[\times[M,2M[^2\times[N,2N[\longleftrightarrow (\ov an,am_1,am_2)\mods q=(r,s_1,s_2)\in\mathbf{F}_q^3.$$
Considering the fiber counting function for that map, namely
$$\nu(r,s_1,s_2):=\sumsum_\stacksum{(a,n,m_1,m_2)}{a\sim A, |n|\leq 2N,\ m_i\simeq M}\alpha_{m_1}\ov{\alpha_{m_2}}\delta_{\ov an=r,\ am_i=s_i\mods q}$$
one shows that for $AN<q/2$ one has
$$\sumsum_{(r,s_1,s_2)\in{\mathbf{F}_q}^3}|\nu(r,s_1,s_2)|\ll AM^2N,\ \sumsum_{(r,s_1,s_2)\in{\mathbf{F}_q}^3}|\nu(r,s_1,s_2)|^2\leq q^{o(1)}AM^2N.$$
Applying H\"older's inequality leads us to the problem of bounding the following complete sum indexed by the parameter $\uple{b}$
\begin{equation}\label{typeIIcomplete}
\sum_{r\in{\mathbf{F}_q}}|\mathbf{R}(r,\uple{b})|^2-q\sum_{r\in{\mathbf{F}_q}}|\mathbf{K}(r,\uple{b})|^2.
\end{equation}
We will explain what is expected in general in a short moment but let us see what happens for our previous case $K(x)=\mathrm{e}_q(\ov x+x)$: for $\uple{b}=(b_1,\ldots,b_{2l})\in{\mathbf{F}_q}^{2l}$ satisfying \eqref{bcond} the sum \eqref{typeIIcomplete} equals
$$q\sum_\stacksum{r\in{\mathbf{F}_q}}{r\not=-b_i}|\Kl_2(G_\uple{b}(r);q)|^2-q\sum_\stacksum{r\in{\mathbf{F}_q}}{r\not=-b_i}1=q\sum_\stacksum{r\in{\mathbf{F}_q}}{r\not=-b_i}(|\Kl_2(G_\uple{b}(r);q)|^2-1)+O_l(q)$$
where $G_\uple{b}(X)$ is defined in \eqref{Gbdef}
\begin{lemma}For $\uple{b}=(b_1,\ldots,b_{2l})\in{\mathbf{F}_q}^{2l}$ satisfying \eqref{bcond}, one has
	$$\sum_r(|\Kl_2(G_\uple{b}(r);q)|^2-1)\ll_l q^{1/2}.$$
\end{lemma}
\proof This follows from the fact that $[G_\uple{b}]^*\mathcal{K}\ell_2$ is geometrically irreducible with geometric monodromy group equal to $\SL_2$: since the tensor product of the standard representation of $\SL_2$ with itself equals the trivial representation plus the symmetric square of the standard representation which is non-trivial and irreducible,
$$x\mapsto |\Kl_2(G_\uple{b}(r);q)|^2-1$$
is the trace function of a geometrically irreducible sheaf.\qed

Using this bound and trivial estimates for $\uple{b}$ not satisfying \eqref{bcond}, one eventually obtains
\begin{theorem}\label{kloosfracprop} Let $K(x)=\mathrm{e}_q(\ov x+x)$, $1\leq M,N<q$ and $l\geq 1$ some integer. Assuming that
$$N<\frac12 q^{1/2+1/2l},$$ one has
$$B(K,\uple{\alpha},\uple{\beta})=\sumsum_{m\sim M,n\sim N}\alpha_m\beta_n K(mn)\ll q^{o(1)}MN(\frac1M+(\frac{MN}{q^{3/4+3/4l}})^{-1/4l})^{1/2}.$$
\end{theorem}
\begin{remark}
For $l$ large enough, this bound is non-trivial as long as $M\geq q^\delta$ and $MN\geq q^{3/4+\delta}$, again improving on Theorem
\ref{thmbilinear} in this specific case.
\end{remark}

\subsection{The $+ab$-shift for more general trace functions}

For applications to analytic number theory, it is highly desirable to extend the method of the previous section to trace functions as general as possible. This method may be axiomatized in the following way.
Let $q$ be a prime, $K\colon {\mathbf{F}_q}\rightarrow \mathbf{C}$ a complex valued function bounded by $1$ in absolute value, $1\leq M,N<q$ some parameters and
$\uple{\alpha}=(\alpha_m)_{m\sim M}$, $\uple{\beta}=(\beta_n)_{n\sim N}$  sequences of complex number bounded by $1$. We define the type I sum
$$B(K,\uple{\alpha},1_N)=\sumsum_{m\sim M,n\sim N}\alpha_m K(mn)$$
and the type II sum
$$B(K,\uple{\alpha},\uple{\beta})=\sumsum_{m\sim M,n\sim N}\alpha_m\beta_n K(mn).$$

For $l\geq 1$ an integer, let $\mathbf{K}(r,\uple{b})$ and $\mathbf{R}(r,\uple{b})$ be the functions of the variables $(r,\uple{b})\in{\mathbf{F}_q}\times{\mathbf{F}_q}^{2l}$ given by \eqref{KRdef}. For $B\geq 1$ we set
$$\mathcal{B}=\mathbf{Z}^{2l}\cap[B,2B[^{2l}.$$

An axiomatic treatment of the type I sums $B(K,\uple{\alpha},1_N)$ is provided by the following:

\begin{theorem}\label{thmtypeI} Notations as above, let $B,C\geq 1$ and $\gamma\in [0,2]$ be some real numbers.
\begin{itemize}
	\item  Let $\mathcal{B}^{\Delta}\subset \mathcal{B}$ be the set of $\uple{b}\in\mathcal{B}$ for which
	\begin{equation}\label{Rcontrol}
	\hbox{ there exists }r\in{\mathbf{F}_q}\hbox{ satisfying } |\mathbf{R}(r,\uple{b})|> Cq^{1/2}.
	\end{equation}

	\item  Let $\mathcal{B}_I^{bad}\subset \mathcal{B}$ be the union of $\mathcal{B}^{\Delta}$ and the set of $\uple{b}\in\mathcal{B}$ such that
		\begin{equation}\label{RScontrol}\bigl|\sum_{r\in{\mathbf{F}_q}}\mathbf{R}(r,\uple{b})\bigr|> Cq.
		\end{equation}
\end{itemize}
Suppose that for any $1\leq B<q/2$ one has
\begin{equation}\label{badsetbound1}|\mathcal{B}^{\Delta}|\leq CB^l,\ |\mathcal{B}_I^{bad}|\leq B^{(2-\gamma)l}	.
\end{equation}

Then, if $N$ satisfies $$q^{1/l}\leq N\leq \frac12q^{1/2+1/2l},$$ one has for any $\varepsilon>0$
\begin{equation}\label{typeIKMS}B(K,\uple{\alpha},1_N)\ll_{C,l,\varepsilon}q^\varepsilon MN(\frac{q^{1+1/l}}{MN^2}+\frac{q^{3/2-\gamma+1/l}}{MN^2})^{1/2l}.
\end{equation}
\end{theorem}

An axiomatic treatment of the type II sums $B(K,\uple{\alpha},\uple{\beta})$ is provided by the following
\begin{theorem}\label{thmtypeII} Notations as above, let $B,C\geq 1$ and $\gamma\in [0,2]$ be some real numbers,
\begin{itemize}
	\item  Let $\mathcal{B}^{\Delta}\subset \mathcal{B}$ be the set of $\uple{b}\in\mathcal{B}$ for which
	$$\hbox{ there exists }r\in{\mathbf{F}_q}\hbox{ satisfying } |\mathbf{R}(r,\uple{b})|> Cq^{1/2}.$$
	\item  Let $\mathcal{B}_{II}^{bad}\subset \mathcal{B}$ be the union of $\mathcal{B}^{\Delta}$ and the set of $\uple{b}\in\mathcal{B}$ such that	\begin{equation}\label{RScontrol2}\bigl|\sum_{r\in{\mathbf{F}_q}}|\mathbf{R}(r,\uple{b})|^2-q\sum_{r\in{\mathbf{F}_q}}|\mathbf{K}(r,\uple{b})|^2\bigr|> C q^{3/2}	.
	\end{equation}

\end{itemize}
Assume that for any  $B\in[1,q/2[$ one has
\begin{equation}\label{badsetbound2}|\mathcal{B}^{\Delta}|\leq CB^l,\ |\mathcal{B}_{II}^{bad}|\leq CB^{(2-\gamma)l}.
\end{equation}
Then, if $N$ satisfies $$q^{3/2l}\leq N\leq \frac12q^{1/2+3/4l},$$  one has  for any $\varepsilon>0$,
\begin{equation}\label{typeIIKMS}
B(K,\uple{\alpha},\uple{\beta})\ll_{C,l,\varepsilon}q^\varepsilon MN\bigl(\frac{1}{M}+(\frac{q^{1-\frac{3}4\gamma+\frac{3}{4l}}}{MN}+\frac{q^{\frac{3}{4}+\frac{3}{4l}}}{MN})^{\frac1{l}}\bigr)^{1/2}.
\end{equation}

\end{theorem}

We conclude these lectures with a few remarks concerning these two theorems:

\begin{enumerate}
\item 	In the case $K(x)=\mathrm{e}_q(\ov x+x)$, we have just verified that the conditions \eqref{badsetbound1} and \eqref{badsetbound2} hold with $\gamma=1$. In \cite{FoMi}, this was shown to hold more generally for the trace functions
$$K(x)=\mathrm{e}_q(x^{-k}+ax),\ a\in{\mathbf{F}_q},\ k\geq 1.$$

\item For more general trace functions, the first condition in \eqref{badsetbound1} and \eqref{badsetbound2} can be verified using some variant of the "sums of products" Theorem \ref{cor-concrete} and does not constitute a big obstacle. One should also notice that Theorem \ref{cor-concrete} implies that for any $\uple{b}=(b_1,\ldots,b_{2l})$ on the "first" diagonal (i.e.~$b_1=b_{l+1},\ldots,b_{l}=b_{2l}$) one has
$$\mathbf{R}(r,\uple{b})=\sum_{s}\prod_{i=1}^l|K(s(r+b_i))|^{2}=|K(0)|^{2l}+\sum_{s\not=0}\prod_{i=1}^l|K(s(r+b_i))|^{2}\gg_l q$$
and therefore
$$|\mathcal{B}^\Delta|\geq B^{l}.$$
It follows that the first bound in \eqref{badsetbound1} and \eqref{badsetbound2} is sharp and for the second condition one cannot expect  $\gamma$ to be greater than $1$.
\item In order to reach the best available bound by the above method, it is not necessary to aim for $\gamma=1$: it is sufficient to establish \eqref{badsetbound1} with $\gamma\geq 1/2$ and \eqref{badsetbound2} with $\gamma\geq 1/3$. In such a case, the bounds of Theorem \ref{thmtypeI} and Theorem \ref{thmtypeII} are non trivial as long as
$$MN^2\geq q^{1+1/l},\ MN\geq q^{3/4+3/4l},$$
respectively.

\item Checking the second bound in \eqref{badsetbound1} and \eqref{badsetbound2} for general trace functions is much more difficult. In \cite{KMS}, with specific applications in mind, these bounds have been established for $l=2$ and $\gamma=1/2$  for the  hyper-Kloosterman sums
$$K(x)=\Kl_k(x;q),\ k\geq 2.$$
 Because $l=2$ is too small, this alone is not sufficient to improve over the P\'olya-Vinogradov type bound of Theorem \ref{thmbilinear} (one would have needed $l\geq 4$). A more refined treatment is necessary: instead of letting (somewhat wastefully) the variables $s=am\mods q$ or $s_1=am_1,s_2=am_2 \mods q$ vary freely over the whole interval $[0,q-1]\simeq {\mathbf{F}_q}$, one uses the fact that $s,s_1,s_2$ belong to the shorter interval $[AM,4AM[$. Applying the P\'olya-Vinogradov completion method to detect this inclusion with additive characters, this leads to bounds for complete sums analogous to \eqref{RScontrol} and \eqref{RScontrol2} but for the additively twisted variant of $\mathbf{R}(r,\uple{b})$ defined by
 $$\mathbf{R}(r,\lambda,\uple{b})=\sum_{s}\mathbf{K}(sr,s\uple{b})e\left(\frac{\lambda s}q\right),\ \hbox{ for }\lambda\in{\mathbf{F}_q}.$$
Specifically, the bounds are: for all $ \uple{b}\in\mathcal{B}-\mathcal{B}^{\Delta},$ we have
 $$\forall\lambda\in{\mathbf{F}_q},\ |\mathbf{R}(r,\lambda,\uple{b})|\leq Cq^{1/2},$$
 and for all $\uple{b}\in\mathcal{B}-\mathcal{B}_I^{bad}$, we have
  $$\forall\lambda\in{\mathbf{F}_q},\ |\sum_r\mathbf{R}(r,\lambda,\uple{b})|\leq Cq,$$
  and for all $\uple{b}\in\mathcal{B}-\mathcal{B}_{II}^{bad}$, we have
$$\forall\lambda,\lambda'\in{\mathbf{F}_q},\ \Bigl|\sum_r\mathbf{R}(r,\lambda,\uple{b})\ov{\mathbf{R}(r,\lambda',\uple{b})}-q\delta_{\lambda=\lambda'}\sum_{s}\prod_{i=1}^l|K(s(r+b_i))|^{2}\Bigr|\leq Cq^{3/2}.
$$
In \cite{KMS}, these bounds were established for $l=2$ and $\uple{b}$ outside the sets $\mathcal{B}^\Delta$, $\mathcal{B}_{I}^{bad}$ and $\mathcal{B}_{II}^{bad}$
satisfying
$$|\mathcal{B}^\Delta|\leq B^2,\ |\mathcal{B}_{I,II}^{bad}|\leq CB^{3}.$$

\item In the  paper \cite{KMS2}, the bounds \eqref{badsetbound1} and \eqref{badsetbound2} are established for the  hyper-Kloosterman sums and generalized Kloosterman sums for every $l\geq 2$ and $\gamma=1/2$.
\end{enumerate}

\subsection{Some applications of the $+ab$-shift bounds}

The problem of estimating bilinear sums of trace functions below the critical P\'olya-Vinogradov range already had several applications in analytic number theory. We list some of them below with references for the interested remaining reader(s).
\begin{itemize}
\item This method was used by Karatsuba and Vinogradov, for the function
 $$K(n)=\chi(n+a)$$
where $(a,q)=1$ and $\chi\mods q$ is a non-trivial Dirichlet character, to bound non-trivially its sum along the primes over short intervals (now a special case of Theorem \ref{thmprimesumthm}). In particular, Karatsuba \cite{Kar} proved for any $\varepsilon>0$, the bound
$$\sum_\stacksum{p\leq x}{p\ \mathrm{ prime}}\chi(p+a)\ll x^{1-\varepsilon^2/1024}$$
whenever $x\geq q^{1/2+\varepsilon}$. This bound is therefore non-trivial in a range which is wider than that established in Theorem \ref{thmprimesumthm} for general trace functions.
\item The method was used by Friedlander-Iwaniec for the function
$$K(n)=e\left(\frac{\ov n}q\right),\ n.\ov n\equiv 1\mods q$$
to show that the ternary divisor function $d_3(n)$ is well distributed in arithmetic progressions to modulus $q\leq x^{1/2+1/230}$, passing for the first time the Bombieri-Vinogradov barrier (see Theorem \ref{thmd3}).
\item In the case of the Kloosterman sums
 $$K(n)=\Kl_2(n;q),$$
the bound established in \cite{KMS} together with \cite{BlMi,BFKMM} leads to an asymptotic formula for the second moment of character twists of modular $L$-functions: for $f$ a fixed primitive cusp form, one has
$$\frac{1}{q-1}\sum_{\chi\mods q}|L(f\otimes\chi,1/2)|^2= MT_f(\log q)+O_f(q^{-1/145})$$
for $q$ prime, where $MT_f(\log q)$ is a polynomial in $\log q$ (of degree $\leq 1$) depending on $f$. This completes the work of Young for $f$ an Eisenstein series \cite{Young} and of Blomer-Milicevic for $f$ cuspidal and $q$ suitably composite \cite{BlMi}.
\item Using  this method, Nunes \cite{nunes} obtained non-trivial bounds, below the P\'olya-Vinogradov range, for the  (smooth) bilinear sum
$$\sumsum_\stacksum{m\leq M}{n\leq N}K(mn^2)$$
where $K$ is the Kloosterman-like trace function
$$K(n;q):=\frac{1}{q^{1/2}}\sum_{x\in{\mathbf{F}^\times_q}}e_q(a\ov x^{2}+bx)$$
(where $a,b$ are some integral parameters such that $(ab,q)=1$). He deduced from this bound that the characteristic function of squarefree integers
is well-distributed in arithmetic progression to prime modulus
$$q\leq x^{2/3+1/57}.$$
\end{itemize}
The previous best result, due to Prachar \cite{Prachar}, was $q\leq x^{2/3-\varepsilon}$ (similar to Selberg's Theorem \ref{thmd2} for the divisor function $d_2(n)$) dated to 1958 !

\begin{bibdiv}

\begin{biblist}

\bib{BGHT}{article}{
   author={Barnet-Lamb, Tom},
   author={Geraghty, David},
   author={Harris, Michael},
   author={Taylor, Richard},
   title={A family of Calabi-Yau varieties and potential automorphy II},
   journal={Publ. Res. Inst. Math. Sci.},
   volume={47},
   date={2011},
   number={1},
   pages={29--98},
   issn={0034-5318},

}

\bib{BirchST}{article}{
   author={Birch, B. J.},
   title={How the number of points of an elliptic curve over a fixed prime
   field varies},
   journal={J. London Math. Soc.},
   volume={43},
   date={1968},
   pages={57--60},
   issn={0024-6107},

}

\bib{BlMi}{article}{
   author={Blomer, V.},
   author={Mili{\'c}evi{\'c}, D.},
   title={The second moment of twisted modular $L$-functions},
   journal={Geom. Funct. Anal.},
   volume={25},
   date={2015},
   number={2},
   pages={453--516},
}

\bib{BFKMM}{article}{
   author={Blomer, Valentin},
   author={Fouvry, \'Etienne},
   author={Kowalski, Emmanuel},
   author={Michel, Ph.},
   author={Mili\'cevi\'c, Djordje},
   title={On moments of twisted $L$-functions},
   journal={Amer. J. Math.},
   volume={139},
   date={2017},
   number={3},
   pages={707--768},
   note={\url{arXiv:1411.4467}}
}

 \bib{BFI}{article}{
   author={Bombieri, E.},
   author={Friedlander, J. B.},
   author={Iwaniec, H.},
   title={Primes in arithmetic progressions to large moduli},
   journal={Acta Math.},
   volume={156},
   date={1986},
   number={3-4},
   pages={203--251},
   issn={0001-5962},
}

\bib{Bur}{article}{
   author={Burgess, D. A.},
   title={On character sums and primitive roots},
   journal={Proc. London Math. Soc. (3)},
   volume={12},
   date={1962},
   pages={179--192},
   issn={0024-6115},

}

\bib{CHT}{article}{
   author={Clozel, Laurent},
   author={Harris, Michael},
   author={Taylor, Richard},
   title={Automorphy for some $l$-adic lifts of automorphic mod $l$ Galois
   representations},
   note={With Appendix A, summarizing unpublished work of Russ Mann, and
   Appendix B by Marie-France Vign\'eras},
   journal={Publ. Math. Inst. Hautes \'Etudes Sci.},
   number={108},
   date={2008},
   pages={1--181},
   issn={0073-8301},

}

\bib{WeilII}{article}{
  author={Deligne, P.},
  title={La conjecture de Weil, II},
  journal={Publ. Math. IH\'ES},
  volume={52},
  date={1980},
  pages={137--252},
}

 \bib{DFISalie}{article}{
   author={Duke, W.},
   author={Friedlander, J. B.},
   author={Iwaniec, H.},
   title={Equidistribution of roots of a quadratic congruence to prime
   moduli},
   journal={Ann. of Math. (2)},
   volume={141},
   date={1995},
   number={2},
   pages={423--441},
   issn={0003-486X},

}

 \bib{Fou}{article}{
   author={Fouvry, \'Etienne},
   title={Autour du th\'eor\`eme de Bombieri-Vinogradov},
   language={French},
   journal={Acta Math.},
   volume={152},
   date={1984},
   number={3-4},
   pages={219--244},
   issn={0001-5962},

}

 \bib{FouCrelle}{article}{
   author={Fouvry, \'E.},
   title={Sur le probl\`eme des diviseurs de Titchmarsh},
   language={French},
   journal={J. Reine Angew. Math.},
   volume={357},
   date={1985},
   pages={51--76},
   issn={0075-4102},

}

\bib{FIActaAr}{article}{
   author={Fouvry, \'E.},
   author={Iwaniec, H.},
   author={},
   title={Primes in arithmetic progressions},
   journal={Acta Arith.},
   volume={42},
   date={1983},
   number={2},
   pages={197--218},
   issn={0065-1036},

}

\bib{FoIw}{article}{
   author={Fouvry, {\'E}tienne},
   author={Iwaniec, Henryk},
   title={The divisor function over arithmetic progressions},
   note={With an appendix by Nicholas Katz},
   journal={Acta Arith.},
   volume={61},
   date={1992},
   number={3},
   pages={271--287},
   issn={0065-1036},

}

\bib{FKM1}{article}{
   author={Fouvry, {\'E}.},
   author={Kowalski, E.},
   author={Michel, Ph.},
   title={Algebraic twists of modular forms and Hecke orbits},
   journal={GAFA},
   volume={25},
   note={\url{arXiv:1207.0617}},
   date={2015},
   number={2},
   pages={580-657},
 }

\bib{MRL}{article}{
  author={Fouvry, {\'E}.},
   author={Kowalski, E.},
   author={Michel, Ph.},
   title={Counting sheaves using spherical codes},
   journal={Math. Res. Lett.},
   volume={20},
   date={2013},
   number={2},
   pages={305--323},
 }

 \bib{FKMSP}{article}{
   author={Fouvry, {\' E}.},
   author={Kowalski, E.},
   author={Michel, Ph.},
   title={A study in sums of products},
   journal={Philos. Trans. A},
   volume={373},
   date={2015},
   number={2040},
   pages={20140309, 26pp.},
   note={\url{arXiv:1304.3199}},

}

 \bib{FKM2}{article}{
   author={Fouvry, {\'E}.},
   author={Kowalski, E.},
   author={Michel, Ph.},
   title={Algebraic trace functions over the primes},
   journal={Duke Math. J.},
   volume={163},
   number={9},
   pages={1683--1736},
   date={2014},
   note={\url{arXiv:1211.6043}},
}

\bib{FKM3}{article}{
   author={Fouvry, {\'E}.},
   author={Kowalski, E.},
   author={Michel, Ph.},
   title={On the exponent of distribution of the ternary divisor function},
   journal={Mathematika},
   note={\url{arXiv:1304.3199}},
   date={2015},
   volume={61},
   number={1},
   pages={121-144},
 }

\bib{FoMi}{article}{
  author={Fouvry, {\'E.}},
  author={Michel, {Ph.}},
  title={Sur certaines sommes d'exponentielles sur les nombres premiers},
  journal={Ann. Sci. \' Ecole Norm. Sup. (4)},
  volume={31},
  number={1},
  date={1998},
  pages={93--130},
}

\bib{FouMiAnn}{article}{
   author={Fouvry, \'E.},
   author={Michel, Ph.},
   title={Sur le changement de signe des sommes de Kloosterman},
   journal={Ann. of Math. (2)},
   volume={165},
   date={2007},
   number={3},
   pages={675-715},

}

\bib{FKMRRS}{article}{
   author={Fouvry, {\'E}tienne},
   author={Kowalski, Emmanuel},
   author={Michel, Ph.},
   author={Raju, C. S.},
   author={Rivat, J.}
   author={Soundararajan, K.}
   title={On short sums of trace functions},
   note={\tt  arxiv:1508.00512},
   journal={Ann. Inst. Fourier (Grenoble)}
   date={2017},
   volume={167},
   number={1},
   pages={423--449}

 }

\bib{FrIw}{article}{
  author={Friedlander, J.B.},
  author={Iwaniec, H.},
  title={Incomplete Kloosterman sums and a divisor problem},
  note={(with an appendix by
  B. J. Birch and E. Bombieri)},
  journal={Ann. of Math. (2)},
  volume={121},
  date={1985},
  number={2},
  pages={319--350},
}

\bib{GYP}{article}{
   author={Goldston, Daniel A.},
   author={Pintz, J\'anos},
   author={Y\i ld\i r\i m, Cem Y.},
   title={Primes in tuples. I},
   journal={Ann. of Math. (2)},
   volume={170},
   date={2009},
   number={2},
   pages={819--862},
   issn={0003-486X},

}

\bib{Gran}{article}{
   author={Granville, Andrew},
   title={Primes in intervals of bounded length},
   journal={Bull. Amer. Math. Soc. (N.S).},
   volume={52},
   date={2015},
   number={2},
   pages={171--222},
   issn={0273-0979},

}

\bib{HSBT}{article}{
   author={Harris, Michael},
   author={Shepherd-Barron, Nick},
   author={Taylor, Richard},
   title={A family of Calabi-Yau varieties and potential automorphy},
   journal={Ann. of Math. (2)},
   volume={171},
   date={2010},
   number={2},
   pages={779--813},
   issn={0003-486X},

}

\bib{HBPatt}{article}{
   author={Heath-Brown, D. R.},
   author={Patterson, S. J.},
   title={The distribution of Kummer sums at prime arguments},
   journal={J. Reine Angew. Math.},
   volume={310},
   date={1979},
   pages={111--130},
   issn={0075-4102},

}

\bib{HBActa}{article}{
  author={Heath--Brown, D.R.},
  title={The divisor function $d_3(n)$ in arithmetic progressions},
  journal={Acta Arith.},
  date={1986},
  volume={47},
  pages={29--56},
  label={HB86},
}

\bib{IT}{article}{
   author={Ichino, Atsushi},
   author={Templier, Nicolas},
   title={On the Vorono\u\i \ formula for ${\rm GL}(n)$},
   journal={Amer. J. Math.},
   volume={135},
   date={2013},
   number={1},
   pages={65--101},
   issn={0002-9327},

}

 \bib{IrvingIMRN}{article}{
   author={Irving, Alastair},
   title={The divisor function in arithmetic progressions to smooth moduli},
   journal={Int. Math. Res. Not. IMRN},
   date={2015},
   number={15},
   pages={6675--6698},
   issn={1073-7928},

}

  \bib{IrvingIMRN2}{article}{
   author={Irving, Alastair},
   title={Estimates for character sums and Dirichlet $L$-functions to smooth
   moduli},
   journal={Int. Math. Res. Not. IMRN},
   date={2016},
   number={15},
   pages={4602--4633},
   issn={1073-7928},

}

\bib{IwTopics}{book}{
   author={Iwaniec, Henryk},
   title={Topics in classical automorphic forms},
   series={Graduate Studies in Mathematics},
   volume={17},
   publisher={American Mathematical Society, Providence, RI},
   date={1997},
   pages={xii+259},
   isbn={0-8218-0777-3},

}

\bib{IwKo}{book}{
  author={Iwaniec, H.},
  author={Kowalski, E.},
  title={Analytic number theory},
  publisher={American Mathematical Society Colloquium Publications,  American Mathematical Society},
  volume={53},
  address={Providence, RI},
  date={2004},
}

\bib{IS1}{article}{
   author={Iwaniec, Henryk},
   author={Sarnak, Peter},
   title={The non-vanishing of central values of automorphic $L$-functions
   and Landau-Siegel zeros},
   journal={Israel J. Math.},
   volume={120},
   date={2000},
   number={part A},
   part={part A},
   pages={155--177},
   issn={0021-2172},

}

\bib{IS2}{article}{
   author={Iwaniec, H.},
   author={Sarnak, P.},
   title={Dirichlet $L$-functions at the central point},
   conference={
      title={Number theory in progress, Vol. 2},
      address={Zakopane-Ko\'scielisko},
      date={1997},
   },
   book={
      publisher={de Gruyter, Berlin},
   },
   date={1999},
   pages={941--952},

}

\bib{kale}{article}{
   author={Kabatjanski{\u\i}, G. A.},
   author={Leven{\v{s}}te{\u\i}n, V. I.},
   title={Bounds for packings on the sphere and in space},
   language={Russian},
   journal={Problemy Pereda\v ci Informacii},
   volume={14},
   date={1978},
   number={1},
   pages={3--25},
   issn={0555-2923},

}

\bib{Kar}{article}{
   author={Karatsuba, A. A.},
   title={Sums of characters with prime numbers},
   language={Russian},
   journal={Izv. Akad. Nauk SSSR Ser. Mat.},
   volume={34},
   date={1970},
   pages={299--321},
   issn={0373-2436},

}

\bib{Sommes}{book}{
   author={Katz, N. M.},
   title={Sommes exponentielles},
   series={Ast\'erisque},
   volume={79},
   publisher={Soci\'et\'e Math\'ematique de France},
   address={Paris},
   date={1980},
   pages={209},
}

\bib{GKM}{book}{
   author={Katz, N. M.},
   title={Gauss sums, Kloosterman sums, and monodromy groups},
   series={Annals of Mathematics Studies},
   volume={116},
   publisher={Princeton University Press},
   address={Princeton, NJ},
   date={1988},
}

\bib{ESDE}{book}{
   author={Katz, N. M.},
   title={Exponential sums and differential equations},
   series={Annals of Mathematics Studies},
   volume={124},
   publisher={Princeton University Press},
   address={Princeton, NJ},
   date={1990},
}
\bib{Katzbull}{article}{
   author={Katz, Nicholas M.},
   title={Exponential sums over finite fields and differential equations
   over the complex numbers: some interactions},
   journal={Bull. Amer. Math. Soc. (N.S).},
   volume={23},
   date={1990},
   number={2},
   pages={269--309},
   issn={0273-0979},

}
\bib{KatzRLS}{book}{
   author={Katz, N. M.},
   title={Rigid local systems},
   series={Annals of Mathematics Studies},
   volume={139},
   publisher={Princeton University Press},
   address={Princeton, NJ},
   date={1996},
}

\bib{MMP}{book}{
   author={Katz, N. M.},
   title={Moments, monodromy, and perversity: a Diophantine perspective},
   series={Annals of Mathematics Studies},
   volume={159},
   publisher={Princeton University Press},
   address={Princeton, NJ},
   date={2005},
}

\bib{TLM}{book}{
   author={Katz, N. M.},
   title={Twisted L-Functions and Monodromy},
   series={Annals of Mathematics Studies},
   volume={150},
   publisher={Princeton University Press},
   address={Princeton, NJ},
   date={2005},
}

\bib{KatzConvol}{book}{
   author={Katz, Nicholas M.},
   title={Convolution and equidistribution: Sato-Tate theorems for finite-field Mellin transforms},
   series={Annals of Mathematics Studies},
   volume={180},

   publisher={Princeton University Press, Princeton, NJ},
   date={2012},
   pages={viii+203},
   isbn={978-0-691-15331-5},

}

\bib{KhNg}{article}{
   author={Khan, Rizwanur},
   author={Ngo, Hieu T.},
   title={Nonvanishing of Dirichlet $L$-functions},
   journal={Algebra Number Theory},
   volume={10},
   date={2016},
   number={10},
   pages={2081--2091},
   issn={1937-0652},

}

\bib{KirZhou}{article}{
   author={K\i ral, Eren Mehmet},
   author={Zhou, Fan},
   title={The Voronoi formula and double Dirichlet series},
   journal={Algebra Number Theory},
   volume={10},
   date={2016},
   number={10},
   pages={2267--2286},
   issn={1937-0652},

}

\bib{Kloost}{article}{
   author={Kloosterman, H. D.},
   title={On the representation of numbers in the form
   $ax^2+by^2+cz^2+dt^2$},
   journal={Acta Math.},
   volume={49},
   date={1927},
   number={3-4},
   pages={407--464},
   issn={0001-5962},

}

\bib{K}{article}{
   author={Kowalski, E.},
   title={Families of cusp forms},
   conference={
      title={Actes de la Conf\'erence ``Th\'eorie des Nombres et Applications''},
   },
   book={
      series={Publ. Math. Besan\c{c}on Alg\`ebre Th\'eorie Nr.},
      volume={2013},
      publisher={Presses Univ. Franche-Comt\'e, Besan\c{c}on},
   },
   date={2013},
   pages={5--40},

}

\bib{KowBBK1}{article}{
   author={Kowalski, Emmanuel},
   title={Gaps between prime numbers and primes in arithmetic progressions
   [after Y. Zhang and J. Maynard]},
   journal={Ast\'erisque},
   number={367-368},
   date={2015},
   pages={Exp. No. 1084, ix, 327--366},

}

\bib{KMS}{article}{
   author={Kowalski, Emmanuel},
   author={Michel, Ph.},
   author={Sawin, Will},
   title={Bilinear forms with Kloosterman sums and applications},
   journal={Ann. of Math. (2)},
   volume={186},
   date={2017},
   number={2},
   pages={413--500},
 note={\tt arXiv:1511.01636},
}

\bib{KMS2}{article}{
   author={Kowalski, Emmanuel},
   author={Michel, Ph.},
   author={Sawin, Will},
   title={Stratification and averaging for exponential sums :
bilinear forms with generalized Kloosterman sums},
 note={\url{https://arxiv.org/abs/1802.09849}},
 date={2018}
}

\bib{KMVDMJ}{article}{
  author={Kowalski, E.},
  author={Michel, Ph.},
  author={VanderKam, J.},
  title={Rankin--Selberg $L$-functions in the level aspect},
  journal={Duke Math. Journal},
  volume={114},
  date={2002},
  pages={123--191},
}

\bib{laumon87}{article}{
   author={Laumon, G.},
   title={Transformation de Fourier, constantes d'\'equations fonctionnelles
   et conjecture de Weil},
   language={French},
   journal={Inst. Hautes \'Etudes Sci. Publ. Math.},
   volume={65},
   date={1987},
   pages={131--210},
}

\bib{Matomaki}{article}{
   author={Matom\"aki, Kaisa},
   title={A note on signs of Kloosterman sums},
   language={English, with English and French summaries},
   journal={Bull. Soc. Math. France},
   volume={139},
   date={2011},
   number={3},
   pages={287--295},
   issn={0037-9484},

}

\bib{Maynard}{article}{
   author={Maynard, James},
   title={Large gaps between primes},
   journal={Ann. of Math. (2)},
   volume={183},
   date={2016},
   number={3},
   pages={915--933},

}

\bib{Mi1}{article}{
   author={Michel, Ph.},
   title={Autour de la conjecture de Sato-Tate pour les sommes de
   Kloosterman. I},

   journal={Invent. Math.},
   volume={121},
   date={1995},
   number={1},
   pages={61--78},
   issn={0020-9910},

}

\bib{MiDMJ}{article}{
   author={Michel, Ph.},
   title={Minorations de sommes d'exponentielles},

   journal={Duke Math. J.},
   volume={95},
   date={1998},
   number={2},
   pages={227--240},
   issn={0012-7094},

}

\bib{MvdK}{article}{
   author={Michel, Ph.},
   author={VanderKam, Jeffrey},
   title={Non-vanishing of high derivatives of Dirichlet $L$-functions at
   the central point},
   journal={J. Number Theory},
   volume={81},
   date={2000},
   number={1},
   pages={130--148},
   issn={0022-314X},

}

\bib{MilSch}{article}{
   author={Miller, Stephen D.},
   author={Schmid, Wilfried},
   title={Automorphic distributions, $L$-functions, and Voronoi summation
   for ${\rm GL}(3)$},
   journal={Ann. of Math. (2)},
   volume={164},
   date={2006},
   number={2},
   pages={423--488},
   issn={0003-486X},

}

\bib{nunes}{article}{
   author={Nunes, R. M.},
   title={On the least squarefree number in an arithmetic progression},
   journal={Mathematika},
   volume={63},
   date={2017},
   number={2},
   pages={483--498}
   }

 \bib{Polymath8a}{article}{
   author={Polymath, D.H.J.},
   title={New equidistribution estimates of Zhang type},
   journal={Algebra \& Number Theory}
   note={{\tt  arXiv:1402.0811}},
   volume={8},
   pages={2067–2199},
   number={9},

   date={2014},
 }

 \bib{Polymath8b}{article}{
   author={Polymath, D. H. J.},
   title={Variants of the Selberg sieve, and bounded intervals containing
   many primes},
   journal={Res. Math. Sci.},
   volume={1},
   date={2014},
   pages={Art. 12, 83},
   issn={2522-0144},

}

 \bib{Prachar}{article}{
   author={Prachar, Karl},
   title={\"Uber die kleinste quadratfreie Zahl einer arithmetischen Reihe},
   language={German},
   journal={Monatsh. Math.},
   volume={62},
   date={1958},
   pages={173--176},

}

\bib{SST}{article}{
   author={Sarnak, Peter},
   author={Shin, Sug Woo},
   author={Templier, Nicolas},
   title={Families of $L$-functions and their symmetry},
   conference={
      title={Families of automorphic forms and the trace formula},
   },
   book={
      series={Simons Symp.},
      publisher={Springer, [Cham]},
   },
   date={2016},
   pages={531--578},

}

\bib{Serre}{book}{
   author={Serre, Jean-Pierre},
   title={Local fields},
   series={Graduate Texts in Mathematics},
   volume={67},
   note={Translated from the French by Marvin Jay Greenberg},
   publisher={Springer-Verlag, New York-Berlin},
   date={1979},
   pages={viii+241},
 }

\bib{Sivak}{article}{
   author={Sivak-Fischler, J.},
   title={Crible asymptotique et sommes de Kloosterman},
   language={French, with English and French summaries},
   journal={Bull. Soc. Math. France},
   volume={137},
   date={2009},
   number={1},
   pages={1--62},
   issn={0037-9484},

}

\bib{SoundGYP}{article}{
   author={Soundararajan, K.},
   title={Small gaps between prime numbers: the work of
   Goldston-Pintz-Y\i ld\i r\i m},
   journal={Bull. Amer. Math. Soc. (N.S).},
   volume={44},
   date={2007},
   number={1},
   pages={1--18},
   issn={0273-0979},

}

\bib{Tay}{article}{
   author={Taylor, Richard},
   title={Automorphy for some $l$-adic lifts of automorphic mod $l$ Galois
   representations. II},
   journal={Publ. Math. Inst. Hautes \'Etudes Sci.},
   number={108},
   date={2008},
   pages={183--239},
   issn={0073-8301},

}

\bib{Vaughan}{book}{
   author={Vaughan, R. C.},
   title={The Hardy--Littlewood method},
   series={Cambridge Tracts in Mathematics},
   volume={125},
   edition={2},
   publisher={Cambridge University Press, Cambridge},
   date={1997},
   pages={xiv+232},
   isbn={0-521-57347-5},

}

\bib{Weil0}{article}{
   author={Weil, Andr\'e},
   title={On the Riemann hypothesis in functionfields},
   journal={Proc. Nat. Acad. Sci. U. S. A.},
   volume={27},
   date={1941},
   pages={345--347},
   issn={0027-8424},

}

\bib{WuPing}{article}{

 author={Wu, J.},
 author={Xi, P.},
 title={ Arithmetic exponent pairs for algebraic trace functions and applications},
 note={\url{https://arxiv.org/abs/1603.07060}},
 date={2016}
}

\bib{Xi}{article}{
   author={Xi, Ping},
   title={Sign changes of Kloosterman sums with almost prime moduli},
   journal={Monatsh. Math.},
   volume={177},
   date={2015},
   number={1},
   pages={141--163},
   issn={0026-9255},

}

\bib{Xi2}{article}{
   author={Xi, Ping},
   title={Sign changes of Kloosterman sums with almost prime moduli, II},
   journal={IMRN},
   volume={2016},
   date={2016},
   number={00},
   pages={1--28},

}

\bib{Young}{article}{
 author={Young, {M.}{P.}},
 title={The fourth moment of Dirichlet $L$-functions},
 journal={Ann. of Math. (2)},
 pages={1--50},
 date={2011},
 volume={173},
 number={1},
}

\bib{YZhang}{article}{
   author={Zhang, Yitang},
   title={Bounded gaps between primes},
   journal={Ann. of Math. (2)},
   volume={179},
   date={2014},
   number={3},
   pages={1121--1174},

}

\bib{sga4h}{book}{
   author={Deligne, P.},
   title={Cohomologie \'etale},
   series={Lecture Notes in Mathematics},
   volume={569},
   note={S\'eminaire de G\'eom\'etrie Alg\'ebrique du Bois-Marie (SGA
   4${\textstyle{\frac{1}{2}}}$)},
   publisher={Springer-Verlag},
   address={Berlin-New York},
   date={1977},
   pages={iv+312pp},
   label={SGA4${\textstyle{\frac{1}{2}}}$},

}

\end{biblist}

\end{bibdiv}

\end{document}

\bibliographystyle{amsplain}

\end{document}

\section{}
\subsection{}

\begin{theorem}[Optional addition to theorem head]
\end{theorem}

\begin{proof}[Optional replacement proof heading]
\end{proof}

\begin{figure}
\includegraphics{filename}
\caption{text of caption}
\label{}
\end{figure}

\begin{equation}
\end{equation}

\begin{equation*}
\end{equation*}

\begin{align}
  &  \\
  &
\end{align}