I think I am confused about some terminology in algebraic geometry, specifically the meaning of the term "torsor". Suppose that I fix a scheme S. I want to work with torsors over S. Let $\mu$ be a sheaf of abelian groups over S. Then my understanding is that a $\mu$-torsor, what ever that is, should be classified by the cohomology gorup $H^1(X; \mu) \cong \check H^1(X; \mu)$. 


Now suppose that $\mu$ is representable in the category of schemes over S, i.e. there is a group object $$\mathbb{G} \to S$$
in the category of schemes over $S$, and maps (over S) to $\mathbb{G}$ is the same as $\mu$. Lots of interesting example arise this way. 


I also thought that in this case a torsor over S can be defined as a scheme $P \to S$ over S with an action of the group $\mathbb{G}$ such that locally in S it is trivial. I.e. there exists a cover $U \to S$ such that 
$$ P \times\_S U \cong \mathbb{G} \times\_S U $$
as spaces over S with a $\mathbb{G}$-action (or rather as spaces over U with a $\mathbb{G} \times\_S U$-action). 


The part that confuses me is that these two notions don't seem to agree. Here is an example that I think shows the difference. Let $S= \mathbb{A}^1$ be the affine line (over a field k) and let $x\_1$ and $x\_2$ by two distinct points in $S$. Consider the subscheme $Y = x\_1 \cup x\_2$, and let $C\_Y$ be the complement of Y in S. Let $A$ be your favorite finite abelian group which we consider as a constant sheaf over S. Then we have an exact sequence of sheaves over S,
$$0 \to A\_{C\_Y} \to A \to i\_\*A \to 0$$
Where $i\_\*A(U) = A(U \cap Y)$. I believe the first two are representable by schemes over S, namely $$C\_Y \times A \cup S \times 0$$
and $S \times A$, where we are viewing the finite set $A$ as a scheme over $k$ (and these products are scheme-theoretic products of schemes over $spec \; k$). 


In any event, the long exact sequence in sheaf cohomology shows that
$$H^1(S; A\_{C\_Y}) \cong \check H^1(S; A\_{C\_Y}) \cong A$$
and it is easy to build an explicit C$\check{\text{e}}$ch cocycle using the covering given by the two opens consisting of the subschemes $U\_i = S \setminus x\_i$, for $i = 1,2$. 


Now the problem comes when I try to glue these together to get a representable object over S, i.e. a torsor in the second sense. Then I am looking at the coequalizer of
$$C\_Y \times A \rightrightarrows (C\_Y\cup C\_Y) \times A$$
where the first map is the inclusion and the second is the usual inclusion together with addition by a given fixed element $a \in A$. This seems to just gives back the trivial "torsor" $C\_Y \times A$. 


Am I doing this calculation wrong, or is there really a difference between these two notions of torsor?



Torsors in Algebraic Geometry?
As remarked by Brian Conrad above, there is an excellent explanation of all this in Milne's book *Étale cohomology*, Section III.4. There wouldn't be much point in reproducing the details here, but the main issues are:


* You need to decide whether a torsor is going to be a scheme over *S* which locally looks like a trivial torsor, or merely a sheaf of sets over *S* which locally looks like a trivial torsor. What people mean by "torsor" can be either of these things. As Milne says, "The question of which sheaf torsors arise from schemes is, in general, quite delicate". If you go for the sheaf definition, then isomorphism classes of torsors are indeed classified by $\check H^1(S,G)$. Beware that if *G* is not commutative then you need to define $\check H^1(S,G)$ appropriately as a pointed set.
* You need to decide which topology all this is happening in; the usual definition of torsor uses the flat topology, though if *G* is smooth over *S* then you can use the étale topology instead.
* Depending on what topology you're using, and what *S* and *G* look like, there may be issues about whether $\check H^1(S,G)$ and $H^1(S,G)$ are isomorphic.


