[step:Reconstruct a principal bundle from a cocycle]
Let $g = (g_{ij}) \in Z^1(\mathcal U,G)$. Let $e_G \in G$ denote the identity element of the Lie group $G$. Define the smooth disjoint union
\begin{align*}
Q := \bigsqcup_{i \in I} U_i \times G.
\end{align*}
For points $(i,x,h) \in U_i \times G$ and $(j,y,k) \in U_j \times G$, define an equivalence relation by declaring
\begin{align*}
(i,x,h) \sim (j,y,k)
\end{align*}
if and only if $x=y \in U_i \cap U_j$ and
\begin{align*}
h = g_{ij}(x)k.
\end{align*}
The relation is reflexive because the cocycle identity with $i=j=k$ gives $g_{ii}(x)=e_G$. It is symmetric because the cocycle identity with indices $i,j,i$ gives $g_{ij}(x)g_{ji}(x)=e_G$, hence $g_{ji}(x)=g_{ij}(x)^{-1}$. It is transitive because, if $h = g_{ij}(x)k$ and $k = g_{j\ell}(x)m$, then
\begin{align*}
h = g_{ij}(x)g_{j\ell}(x)m = g_{i\ell}(x)m
\end{align*}
by the cocycle identity on $U_i \cap U_j \cap U_\ell$.
Let
\begin{align*}
P_g := Q/{\sim}
\end{align*}
and denote the equivalence class of $(i,x,h)$ by $[i,x,h]$. Define
\begin{align*}
\pi_g: P_g \to M, \quad [i,x,h] \mapsto x.
\end{align*}
This is well-defined because equivalent representatives have the same base point. Define a right action of $G$ on $P_g$ by
\begin{align*}
[i,x,h]\cdot r := [i,x,hr]
\end{align*}
for $r \in G$. This is well-defined because, if $h = g_{ij}(x)k$, then $hr = g_{ij}(x)kr$.
For each $i \in I$, define
\begin{align*}
\Psi_i: U_i \times G \to \pi_g^{-1}(U_i), \quad (x,h) \mapsto [i,x,h].
\end{align*}
The map $\Psi_i$ is bijective. Surjectivity follows because every class over $x \in U_i$ has a representative $[j,x,k]$, and then
\begin{align*}
[j,x,k] = [i,x,g_{ij}(x)k].
\end{align*}
Injectivity follows because $[i,x,h]=[i,x,k]$ implies $h=g_{ii}(x)k=k$. Endow $P_g$ with the [quotient topology](/page/Quotient%20Topology) from $Q$. The subsets $\Psi_i(U_i\times G)$ cover $P_g$, and the quotient map restricts on each $U_i\times G$ to the bijection $\Psi_i$. We use the maps $\Psi_i^{-1}:\Psi_i(U_i\times G)\to U_i\times G$ as charts. On overlaps, the transition map is
\begin{align*}
\Psi_i^{-1}\circ \Psi_j: (U_i \cap U_j)\times G \to (U_i \cap U_j)\times G, \quad (x,h) \mapsto (x,g_{ij}(x)h),
\end{align*}
with inverse
\begin{align*}
(x,h) \mapsto (x,g_{ji}(x)h).
\end{align*}
Both maps are smooth because $g_{ij}$ and $g_{ji}$ are smooth and multiplication in the Lie group $G$ is smooth. Thus the product charts are smoothly compatible. Since $M$ and $G$ are smooth manifolds of the intended Hausdorff and second-countable class, and since the cover $\mathcal U$ is numerable, the standard chart-gluing criterion applies: the quotient topology is Hausdorff and second-countable, the charts above form a smooth atlas, and the sets $\Psi_i(U_i\times G)$ are open. With this structure the maps $\Psi_i$ are diffeomorphisms onto open submanifolds covering $P_g$, and the projection and right action are smooth in these charts. Therefore $\pi_g: P_g \to M$ is a smooth principal right $G$-bundle, trivialized over each $U_i$ by $\Psi_i$.
[/step]