TITLE: How is a Stack the generalisation of a sheaf from a 2-category point of view?
QUESTION [12 upvotes]: A stack is usually given in terms of: 
-A category $F$ fibered over another $C$ such that the functor $Hom(x,y), x,y \in F(\alpha), \alpha \in C$ is a sheaf
-The descent data are effective.
There is an equivalent definition, using the Grothendieck construction, which is a correspondence between fibered categories and pseudofunctors in $Cat$. Given this correspondence a stack becomes a (contravariant) pseudofunctor such that descent is effective. 
Now, with this definition in mind it seems obvious that a stack is a generalised sheaf. But here is my doubt: 
When defining a sheaf $T$ over a space $X$, is not unusual to see the following diagram (naively)
$ T(X) \rightarrow T(U) \stackrel{\longrightarrow}{\longrightarrow} T(U \cap U)$
While, saying that descent data are effective is like asking a similar diagram, but there is the difference that here descent satisfies cocycle condition, something which is naively in $U \cap U \cap U$. 
Recalling that (for example) locally constant sheaves automatically satisfy the cocycle condition because of their correspondent covering spaces do. 
So my question is, at the light of my interpretation, the cocycle condition seems to me the only obstruction to the fact that a stack is a generalised sheaf. Am i wrong? Every sheaf trivially satisfies cocycle condition?

REPLY [12 votes]: Let us start with what we know about sheaves, i.e. the "1-level". A sheaf  on a (Grothendieck) site $\mathcal{C}$ is a contravariant functor $F : \mathcal{C}^\text{op} \to \textbf{Set}$ such that for any cover $\{ X\ \to Y\}$ , the diagram
$$F(Y) \to F(X) \stackrel{\longrightarrow}{\longrightarrow} F (X \times_Y X)$$
is an equalizer in the category of sets. For the sake of exposition, I will only consider the case where the cover consists of a single element.
Now suppose we want to move to the "2-level" and talk about stacks. Then we need to throw in the cocycle condition, so we can naively define a stack $F$ to be a contravariant functor $\mathcal{C}^{\text{op}} \to \textbf{Set}$ such that
$$F(Y) \to F(X) \stackrel{\longrightarrow}{\longrightarrow} F (X \times_Y X)\stackrel{\stackrel{\longrightarrow}{\longrightarrow}}{\longrightarrow}  F(X \times_Y X \times_Y X)$$
is an equalizer in the category of sets. The problem now is the following:


If $F$ is some kind of moduli stack, e.g. $F = \mathcal{M}_{1,1}$ then to make $F$ set valued often involves quotiening out isomorphisms. However, this is very bad as the presence of quadratic twists of elliptic curves means $F$ is not injective.


So now what do we do? Well, we can try to not quotient out isomorphisms, and think of $F$ as a groupoid valued functor. But now we have a new problem:


If $F$ is valued in groupoids, what does it mean to say that $F(Y) \to F(X)$ is "injective"?


The solution is the following. Let's go back to situation where $F$ is a plain old sheaf, and let us think of the set $F(X)$ as a category where the only arrow $x \to x'$ is when $x = x'$, otherwise $\operatorname{Hom}(x,x') = \emptyset$. Then now to say that $F(Y) \to F(X)$ is injective is exactly equivalent to the statement that the functor   $F(Y) \to F(X)$ is fully faithful.
The upshot is that to make the right definition (of a prestack), we now know that:

$F(X)$ should be a groupoid. 
$F(Y) \to F(X)$ should be fully faithful.  

We're not there yet, and we need one last modification (at least for $F$ to be a prestack. We need to replace $F(X)$ with $F(X \to Y)$, namely the category of covering data. The objects of this category are pairs $(y, \phi)$ where $y \in F(Y)$ and $\phi : \text{pr}_1^\ast y \to \text{pr}_2^\ast y$ is an isomorphism. A morphism of covering data $ (y, \phi) \to (y', \phi')$ is a map $f : y\to y'$ such that an appropriate diagram commutes (see chapter 8 of the book "Neron Models" by BLR for the exact definition). We can now define:


A groupoid valued functor $F$ (or pseudofunctor in Vistoli's language) is a prestack if the natural pullback functor $F(Y) \to F(X \to Y)$ is fully faithful.


If you unravel what the morphisms are in the category $F(X \to Y)$, you will see this is exactly the condition that the set-valued functor $\underline{\operatorname{Isom}}$ is a plain old sheaf!
So we can finally get to your question. In my view, a stack is a generalized sheaf if you replace sets with groupoids, and if you introduce the category of covering data.