My question regards the definition of Cartier divisors.
Let $X$ be a scheme correspoding to a variety over an algebraically closed field, and $\mathcal{K}$ the constant sheaf of rational functions of $X$. Let $\mathcal{K}^{*}$ the sheaf of invertible elements of $\mathcal{K}$, and $\mathcal{O}_{X}^{*}$ be the sheaf of invertible elements of the structure sheaf. A Cartier divisor on $X$ is a global section of $\mathcal{K}^{*}/\mathcal{O}_{X}^{*}$.
On Robin Hartshone's book "Algebraic Geometry", I read that any Cartier divisor is determined by an open covering $\{U_{i}\}$ of the underlying topological space of $\mathcal{K}^{*}/\mathcal{O}_{X}^{*}$, and for each $U_{i}$ an element $t_{i}\in \Gamma (U_{i},\mathcal{K}^{*})$ such that $t_{i}/t_{j}\in \Gamma (U_{i}\cap U_{j}, \mathcal{O}_{X}^{*})$ for any $i,j$.
It is not clear to me how the latter definition relates to the first one.
This actually has nothing to do with divisors: it is a purely abstract fact about sheaves.
If $A$ and $B$ are abelian sheaves such that $A \subseteq B$, then we can define the quotient presheaf $P$ by setting $P(U) := B(U) / A(U)$. The quotient sheaf $C := B / A$ is the sheaf associated to $P$: this is where the idea of an element defined locally on the sets of an open covering comes from.
In fact, one can show that the stalks satisfy $C_x \cong B_x / A_x$ for every point $x$, and that for any open set $U$ containing $x$ and any section $s \in C(U)$, there is an open set $V$ containing $x$ on which $s|_V$ is in the image of an element in $B(V)$.
Once we're down to the level of abelian groups, we invoke the fact that in general, for abelian groups $H \subseteq G$, one can name elements of $G/H$ by giving an element of $g$ in the right equivalence class. Then the assertion that the elements named by $g$ and by $g'$ are equal in $G/H$ becomes that $g-g' \in H$.