Classifying stacks and homotopy type of a point Suppose we are working in a category of schemes over a scheme $S$. The scheme $S$ itself is geometrically a ``point''. Let $G$ be a group scheme that acts on a scheme $X$. The quotient stack $[X/G]$ looks in a way as a factor of $X$ by a free action of $G$, i.e. if the action is indeed free and there is a scheme $Y$ such that $X$ is a principal bundle over $Y$, isomorphic as a $G$-scheme to $X$, then $Y$ is isomorphic to $[X/G]$.
In particular, if we take $X=S$, we obtain a classifying stack. There is a surjective map $S \to [S/G]$ and every principal $G$-bundle can be obtained as a pullback of it. This strongly resembles the construction of the classifying space in topology, where we have a space $EG$ with a homotopy type of a point and a cover $EG \to BG$ obtained as a factor by a free action of $G$ on $EG$.
Here is my question (which might sound a bit naive): how this similarity to algebraic topology can be explained? I am mostly curious about how it happens that the construction of the classifying stack is not related to the notion of the homotopy type,  whereas the construction of the classifying space relies on the fact that EG has the homotopy type of a point.
 A: This is all best explaied by working with groupoids in schemes. By this, I mean, groupoid objects in the category of schemes over $S$. A groupoid object $\mathcal G$ consists of two schemes $\mathcal G_0$ (the objects) and $\mathcal G_1$ (the morphisms) and a whole bunch of maps between them:
• a map $s:\mathcal G_1\to \mathcal G_0$ that sends an arrow to its source.
• a map $t:\mathcal G_1\to \mathcal G_0$ that sends an arrow to its target.
• a map $e:\mathcal G_0\to \mathcal G_1$ that sends an object to its identity arrow.
• a map $i:\mathcal G_1\to \mathcal G_1$ that sends an arrow to its inverse.
• a map $m:\mathcal G_1\times_{\mathcal G_0}\mathcal G_1\to \mathcal G_1$ that composes arrows.
subject to even more axioms.
From now on, I will simply say "groupoid" instead of groupoid object in schemes.

Let $G$ be a group over $S$.
Then, there is a groupoid called $EG$, whose objects are $G$, and whose arrows are $G\times_S G$. The groupoid $EG$ is equivalent to $S$, viewed as a groupoid with only identity morphisms. The group $G$ acts freely on $EG$ (this is all happening in the category of schemes over $S$), and the quotient $EG/G$ is $BG$. Here, $BG$ is the groupoid with objects $S$ and morphisms $G$.

If $X$ is a scheme over $S$, then $[X/G]$ is the groupoid whose objects are $X$, and whose morphisms are $X\times _S G$.
This groupoid can also be described as the quotient of the (free) diagonal action of $G$ on the groupoid $X\times EG$.

You're asking:
"why is the construction of the classifying stack not related to the notion of the homotopy type, whereas the construction of the classifying space relies on the fact that $EG$ has the homotopy type of a point?".
There are two ways of answering your question:
- One is to make the algebraic-geometric story look a little bit more like what people do in topology. That's what I did above. In particular, the fact that the groupoid $EG$ is equivalent to $S$ is the analog of the fact that $EG$ is contractible in topology.
- The other is to make the topological story a little bit like what people do in algebraic geometry. Namely, instead of defining $BG$ as $EG/G$, define it as the space that represents the functor $X\mapsto$ {iso-classes of $G$-bundles over $X$} where I'm now working in the category of topological spaces and homotopy classes of maps.


I should maybe add:
There is a stack (over the category of $S$-schemes) associated to any groupoid object in $S$-schemes. The converse is not true for general stacks. But it is true, essentially by definition, for Artin stacks. If you restrict yourself to Deligne-Mumford stacks, then you can also assume that the groupoid is particularly nice, namely, that the maps $s$, $t$, $e$, $i$ and $m$ are étale.
