Associating a principal bundle to a torsor In Introduction to the language of stacks and gerbes, Moerdijk defines a torsor to be a sheaf $\mathcal{S}$ on $X$ with a freely transitive left-action of a sheaf of groups $\mathcal{G}$, such  that $X =\bigcup \{ U \in \mathbf{Open}(X), \mathcal{S}(U) \neq \emptyset\}$. I was thinking if one can associate (functorially) a (locally trivial) $G$-principal bundle for some group or, maybe, groupoid $G$ (or, even a family of groupoids) from a given torsor.
For a $G$-principal bundle, one can always go the reverse way, by picking the sheaf of sections and the cocycles as the sheaf of group. However, the fibers of the étale space are discrete, so I don’t know exactly how to recover $G$ and its topology. Is there any known result like this? What is this functor?
 A: So let $G$ be a topological group, $X$ a topological space, and let $\mathcal{G}$ be the sheaf of local functions from $X$ to $G$ (which is a sheaf of group over $X$).
Let $T$ be a (locally trivial) principal $G$-bundle over $X$, then you can easily check that the sheaf of (local) section of $T$ is a $\mathcal{G}$-torsor : being a torsor is a purely locale property and this is trivial on open subsets of $X$ on which $T$ is trivial.
Conversely, if you have a a $\mathcal{G}$-torsor $\mathcal{T}$, then you can construct a locally trivial $G$ principal bundle in the following way:
Let $U_i$ be a covering of $X$ such that for each $i$ on has a section $t_i$ of $\mathcal{T}$ on $U_i$. then on $U_i \wedge U_j$ there is a unique function $\gamma_{i,j}$ from  $U_i \wedge U_j$ to $G$ such that $\gamma_{i,j} t_i =t_j$. this give you a $G$ cocycle which will allow to reconstruct a locally trivial bundle and one easily check that this two operations induce an equivalence between principal bundles and torsors.
A: A torsor is just a group in which all members have equal standing; the special status of the identity being revoked. It has the same relation to groups that affine spaces do to vector spaces. Affine spaces, themselves, are torsors with additional structure corresponding to the multiplication-by-scalar operation of a vector space.
This concept is more broad than the characterizations I see above. We can distinguish ordinary torsors from those which are equipped with the additional structure of manifold, in which the algebraic operations have required differentiability properties, by calling the latter Lie torsors. A Lie torsor has the same relation to a Lie group that a torsor has to a group. It is the group manifold of a Lie group, equipped with the torsor operation - about to be described below.
A torsor $T$ is an equational algebra equipped with a ternary operation
$$a, b, c ∈ T ↦ a/b·c ∈ T$$
such that
$$a/b·b = a = b/b·a,$$
$$a/b·(c/d·e) = (a/b·c)/d·e,$$
for all $a, b, c, d, e ∈ T$. It is Abelian if, in addition, we have
$$a/b·c = c/b·a$$
for all $a, b, c ∈ T$. We can define torsor homomorphism, as usual, as a map between torsors which preserves the ternary operation.
The primary example, as suggested by the notation is that every group is a torsor with the operation $a/b·c = ab^{-1}c$. The torsor is Abelian precisely when the group is and the torsor homomorphisms are precisely those produced from the corresponding group homomorphisms. If the group is $G$, then we could probably call the corresponding torsor $ΣG$.
We can associate a group with $T$ in two different ways; both ways leading to the same result, up to isomorphism. One of these two ways also happens to yield a group action on the torsor by its associated group. The other yields a group bundle on the torsor.
First, we select any element $e ∈ T$ and define the fibre group $T_e$ by the same set $T$ with the identity $e$ and the operations
$$a,b ∈ T ↦ a b ≡ a/e·b ∈ T,$$
$$a ∈ T ↦ a^{-1} ≡ e/a·e ∈ T.$$
Since the following is an torsor identity, which arises as a consequence of the torsor axioms
$$(a/e·f)/(b/e·f)·(c/e·f) = (a/b·c)/e·f.$$
then, the torsor homomorphism
$$a ∈ T_e ↦ a/e·f ∈ T_f$$
yields also a group isomorphism between $T_e$ and $T_f$. That's the torsor version of a "translation operation". When the torsor is an affine geometry, this reduces to an affine translation.
Finally, we may define the group $δT ≡ (T×T)/ρ$ with the relations
$$(c/b·a, d) ρ (a, b/c·d)$$
for all $a, b, c, d ∈ T$ and define both the equivalence classes and group operations by
$$a \backslash b ≡ [a,b]_ρ,$$
$$(a \backslash b)(c \backslash d) ≡ [(a, b/c·d)]_ρ = [(c/b·a, d)]_ρ,$$
$$(a \backslash b)^{-1} ≡ (b \backslash a)$$
for $a, b, c, d ∈ T$. The identity of $δT$ is the equivalence class $e_T = [(a,a)]_ρ$ (noting that $(a,a) ρ (b,b)$ for all $a, b ∈ T$).
This produces a right action on the torsor given by $a(b \backslash c) = a/b·c$ and maps $a \backslash b ∈ δT ↦ e/a·b ∈ T_e$ , with the inverse map $a ∈ T_e ↦ e \backslash a ∈ δT$ establishing the isomorphism between $T_e$ and $δT$, since both maps are group homomorphisms.
This should be enough to establish that $T$ is a principal bundle with group $δT$, in the case of Lie torsors. You still have the one remaining technicality of showing that it has local sections over a family of open domains that cover $T$.
The two operations group ↔ torsor are inverses, up to isomorphism:
$$δΣG ≅ G, ΣδT ≅ T.$$
