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.