Let $X$ be a smooth, projective, geometrically connected curve over a field $k$ and $G$ an an affine algebraic group group over $k$ (we can put more hypotheses on $G$ if necessary). If $K$ denotes the function field of $X$ and $\mathbb{A}$ the corresponding ring of adeles with integral adeles $\mathcal{O}$, I expect that there is a bijection from $G(\mathcal{O}) \backslash G(\mathbb{A}) / G(K)$ to the set of isomorphism classes of $G$-bundles on $X$ (although I have only seen this fact stated when $G = \text{GL}\_n$). Also, I think there should be an interpretation of the "class group" $G(\mathbb{A}) / G(K)$ as $G$-bundles with level structure, but I don't even know how to make this into a precise statement.


Can someone explain these things to me? I would also be happy with a reference.



Adelic description of moduli of $G$-bundles on a curve
The one-sentence answer to this question is: use fpqc descent theory (and an "answer" which doesn't address the role of fpqc descent -- sometimes presented in the form of a reference to a paper of Beauville and Laszlo -- is missing the key technical issue in the rigorous proof when working with general $G$, as far as I know).


We make two "necessary" hypotheses (as noted in the comments to Sawin's answer) for our smooth connected affine $k$-group $G$: ${\rm{H}}^1(K,G) = 1$ for $K = k(X)$ and ${\rm{H}}^1(k',G) = 1$ for all finite extensions $k'/k$. For example, if $k$ is finite then this holds for any simply connected semisimple (connected) $G$ by the theorems of Harder and Lang respectively. If instead $k$ is algebraically closed of char. 0 then it holds for any $G$ by theorems of Tsen and Springer. If $k$ is algebraically closed of positive characteristic then it holds for any connected reductive $k$-group $G$, but Springer's theorem doesn't literally apply; see Remark 2(b) of the Drinfeld-Simpson paper mentioned in the comments to Sawin's answer.


We shall allow $X$ to be any 1-dimensional reduced and irreducible $k$-scheme of finite type, not assumed to be proper or even normal. This way we incorporate Chervov's observations about using singular curves to build in more level structure. 


We construct the desired bijection as follows. Consider a left $G$-torsor $E \rightarrow X$ (local triviality equivalent for the fpqc and etale topologies due to the smoothness of $G$; the equivalence will be crucial later on and is false in general if we try using the Zariski topology, and officially we work with the etale topology in the definition as is traditionally done). Since ${\rm{H}}^1(K,G) = 1$, the generic fiber $E\_{\eta}$ has a $K$-point and this spreads out over a dense open $U$ in $X$. Fix such a $U$ and trivialization $\xi \in E(U)$. 


Let $X^0$ be the set of closed points of $X$. Consider the pullback of $E$ over the completion $O^{\wedge}\_x$ at $x \in X^0$. This pullback is a smooth $O^{\wedge}\_x$-scheme whose special fiber is a $G$-torsor over the finite extension $k(x)$ of $k$ and so has a $k(x)$-point due to the other vanishing hypothesis. By smoothness (!) of $G$ (and the henselian property of $O^{\wedge}\_x$) this lifts to a point $\xi\_x \in E(O^{\wedge}\_x)$.


For each $x \in X^0$ consider the pullbacks of $\xi$ and $\xi\_x$ over $U \times\_X {\rm{Spec}}(O^{\wedge}\_x) = {\rm{Spec}}(K\_x)$ where $K\_x$ is the total ring of fractions (product of finitely many fields) of the 1-dimensional reduced complete local ring $O^{\wedge}\_x$. These two $K\_x$-points of a common $G$-torsor are related through the action of a unique $g\_x \in G(K\_x)$; to be precise, $\xi = g\_x \xi\_x$ in $E(K\_x)$. If $x \in U^0$ then clearly $g\_x \in G(O^{\wedge}\_x)$, so $(g\_x) \in G(\mathbf{A}\_X)$.


If we
change $\xi$ then we multiply every $g\_x$ on the left by some common $g \in G(U)$, and if we change the various $\xi\_x$'s then we multiply each $g\_x$ on the right by an element of
$G(O^{\wedge}\_x)$. Finally, taking into account that we may shrink $U$ (and thereby enlarge $X - U$), we obtain an element
$$(g\_x) \in G(K)\backslash G(\mathbf{A}\_X)/G(O^{\wedge})$$
(where $O^{\wedge} = \prod\_{x \in X^0} O^{\wedge}\_x$) that depends only on the isomorphism class of $E$ over $X$.


Our problem is to show that (i) this adelic double coset determines the isomorphism class of $E$ and (ii) all double cosets arise in this way. 


The assertion (i) is proved as follows. Assume $E$ and $E'$ give rise to the same double coset, so for a Zariski-dense open $U$ in $X$ trivializing $E$ and $E'$ we have $(g'\_x) = \gamma (g\_x) h$ for some $\gamma \in G(K)$ and $h \in G(O^{\wedge})$ with $g'\_x, g\_x \in G(O^{\wedge}\_x)$ for all closed points $x$ of $U$. By shrinking $U$ we may assume $\gamma \in G(U)$. We may replace $\xi\_x$ with $h\_x\xi\_x$ for all $x \in X^0$ and replace $\xi$ with $\gamma \xi$ so that $g'\_x = g\_x$ for all $x$.
In other words, $E\_U$ and $E'\_U$ are each identified with the trivial $G\_U$-torsor and has corresponding trivial $K\_x$-fiber identified with the generic fiber of $G\_{O^{\wedge}\_x}$ via $g\_x$-translation. Working one point of $X - U$ at a time, we just have to check:


${\mathbf{Claim}}$: The category of $G$-torsors over $O\_x$ is equivalent to the category of $G$-torsors over $O^{\wedge}\_x$ equipped with a $K$-descent on its generic fiber over $K\_x$. 


The categorical aspect of this Claim is essential (i.e., we do not just consider sets of isomorphism classes).


Proof: By fpqc descent theory (the "Beauville-Laszlo step", though for us all we need was provided by Grothendieck) applied to the fpqc cover
$${\rm{Spec}}(K) \coprod {\rm{Spec}}(O^{\wedge}\_x) \rightarrow {\rm{Spec}}(O\_x)$$
whose fiber square is ${\rm{Spec}}(K\_x)$, 
the category of affine $O\_x$-schemes is equivalent to the category of affine
$O\_x^{\wedge}$-schemes equipped with a $K$-structure on the generic fiber over $K\_x$. Since the notion of $G$-torsor is well-behaved for the fpqc topology (and recall that fpqc $G$-torsors are automatically etale-topology torsors, due to the smoothness of $G$!!!), this equivalence specializes to the case of $G$-torsors. QED


Now we run the game in reverse. Pick a class in $G(K)\backslash G(\mathbf{A}\_X)/G(O^{\wedge})$ represented by some $(g\_x) \in G(\mathbf{A}\_X)$. Since
$g\_x \in G(O^{\wedge}\_x)$ for all but finitely many $x \in X^0$, we can pick a Zariski-dense open $U$ in $X$ such that $g\_x \in G(O^{\wedge}\_x)$ for all $x \in U^0$, so 
we may change our representative to satisfy $g\_x = 1$ for all $x \in U^0$. Applying the above Claim then enables us to extend the trivial $G\_U$-torsor to a $G$-torsor $E$ over $X$ by fpqc-gluing using the elements $g\_x$ for each $x \in X - U$ one at a time, and by design this $E$ gives rise to the chosen adelic double coset (if we are careful not to mix up $g\_x$ and $g\_x^{-1}$ for $x \in X - U$).


