TITLE: Relation between two notions of $BG$
QUESTION [7 upvotes]: The following is something that's always niggled me a little bit. I usually think about stacks over schemes, so I'm a bit out of my element—I apologize if I say anything silly below.
Let $G$ be a sufficiently topological group (e.g. you can assume a Lie group) and let $\mathsf{Spaces}$ be the category of topological spaces equipped with the obvious Grothendieck topology (i.e. coverings are classical open coverings). We then have on $\mathsf{Spaces}$ the usual stack $BG$ of $G$-torsors.
What is the relationship between the stack $BG$ and the space $BG$? Of course, the stack $BG$ is not representable (it's valued in groupoids in a way not equivalent to a stack valued in sets) but one can consider its component stack $\pi_0BG$ (which assigns to $X$ isomorphism classes of $G$-torsors). Now that we have a set valued stack, it's conceivable that this is representable but, of course, it's not—it's not even a sheaf on $\mathsf{Spaces}$.
That said, $\pi_0 BG$ is 'represented' in the homotopy category in the sense that 
$$BG(X)=[X,BG]$$
which is, after all, something.
So my general question is: what really is the rigorous relationship? How does it generalize?
Some related subquestions are: should one/can one think about a topology on the homotopy category of spaces? If so, are spaces sheaves there, and can one literally say, in such a setup, that $BG$ (as a space up to homotopy) is just $\pi_0 BG$ (as a 'stack on the homotopy category').
Thanks!
EDIT: Just to give an idea, in the theory of stacks over schemes, one can think of $BG$ as being the stack associated to the groupoid in schemes
$$G\overset{\longrightarrow}{\xrightarrow{\text{  }}}\ast$$
perhaps, in a the same formalism, one can do this as a groupoid in spaces? Then, $BG$ as a space is taking this quotient not in the category of stacks (i.e. the stackification of the obvious groupoid valued presheaf) but taking the quotient in spaces? Of course, one has to be careful since one has to take $\ast$, in such a context, to mean a contractible space with a free $G$-action (e.g. $EG$). I don't know rigorously how this all fits together.

REPLY [3 votes]: It occurs to me that the connection between the two notions of $B G$ is more or less the subject of [Moerdijk, Classifying spaces and classifying toposes]. Instead of directly trying to compare the space $B G$ and the stack $B G$, one can try to compare their "representations", or more precisely, the respective (higher) toposes of (higher) sheaves.
I will first discuss the case of a discrete group $G$. The two toposes to be compared are $\mathbf{Sh} (B G)$, the topos of sheaves on the space $B G$, and $\mathcal{B} G$, the topos of $G$-sets. The topos $\mathcal{B} G$ has a universal property with respect to toposes: regarding $G$ as a $G$-set under the regular action, for every Grothendieck topos $\mathcal{E}$, $f \mapsto f^* G$ is an equivalence between the category of geometric morphisms $\mathcal{E} \to \mathcal{B} G$ and the category of $G$-torsors in $\mathcal{E}$. In particular, we have a comparison geometric morphism $\mathbf{Sh} (B G) \to \mathcal{B} G$. Moreover, as is well known, this is a weak homotopy equivalence (in the sense of Artin and Mazur) – this means that the two toposes have isomorphic fundamental groups and cohomology groups with respect to locally constant coefficients. That is one sense in which the space $B G$ and the stack $B G$ represent the same $\infty$-groupoid (or, if you prefer, homotopy type). Of course, there is much more to topos cohomology than just locally constant coefficients, but that disappears when passing to $\infty$-groupoids.
The case of a topological group $G$ is considerably more complicated – after all, what should the analogue of $\mathcal{B} G$ be? If we stick with ordinary 1-toposes, it is no good to look at the topos of $G$-sets (= sets with a continuous $G$-action): if $G$ is connected, then the only possible continuous $G$-action on a set is the trivial one. Ideally, $\mathcal{B} G$ should be the homotopy limit of the cosimplicial diagram $\mathbf{Sh} (B_\bullet G)$, where $B_\bullet G$ is the simplicial bar construction of $G$, whatever $\mathbf{Sh}$ means in this context. This is essentially saying that $\mathcal{B} G$, regarded as a kind of generalised space, is the homotopy colimit of the simplicial space $B_\bullet G$, also regarded as a diagram of generalised spaces. On the other hand, the space $B G$ is the homotopy colimit of the simplicial space $B_\bullet G$ regarded as a diagram of $\infty$-groupoids. Thus, it sounds as if it should be easy to compare the two, but unfortunately $\mathbf{Sh}$ is not (usually) a functor of $\infty$-groupoids – after all, spaces $X$ and $Y$ may be homotopy equivalent without $\mathbf{Sh} (X)$ and $\mathbf{Sh} (Y)$ being equivalent.
To be concrete, suppose $\mathbf{Sh} (X)$ is the $\infty$-topos of $\infty$-sheaves on $X$. There is a full $\infty$-subcategory $\mathbf{LC} (X) \subseteq \mathbf{Sh} (X)$ of locally constant $\infty$-sheaves, and when $X$ is nice enough (I think locally contractible suffices), $\mathbf{LC} (X)$ is equivalent to the slice $\infty$-category $\infty \mathbf{Grpd}_{/ X}$. In that case, the homotopy limit of $\mathbf{LC} (B_\bullet G)$ is indeed $\mathbf{LC} (B G)$. On the other hand, the homotopy limit of $\mathbf{Sh} (B_\bullet G)$ is the $\infty$-topos $\mathcal{B} G$ of equivariant $\infty$-sheaves on $G$. Of course, the locally constant objects in $\mathcal{B} G$ are those such that the underlying $\infty$-sheaf on $G$ is locally constant, so the full $\infty$-subcategory of $\mathcal{B} G$ spanned by the locally constant objects is equivalent to $\mathbf{LC} (B G)$. So this is a precise sense in which the difference between the space $B G$ and the stack $B G$ corresponds to the difference between locally constant sheaves and general sheaves.