Motivation for definition of Quotient stack I am reading "Some notes on Differentiable stacks" by J. Heinloth. In that paper, the notion of quotient stack is defined as follows.

Let $G$ be a Lie group action on a manifold $X$ (left action). We define the quotient stack $[X/G]$ as $[X/G](Y):=\{P\xrightarrow{p} Y, P\xrightarrow{f}X | P\rightarrow Y \text{ is a G-bundle,}  ~ f  \text{ is } G\text{-equivariant}\}$.
Morphisms of objects are $G$-equivariant isomorphisms.

I am trying to understand the motivation for defining in this way.

Given a Lie group action of $G$ on $X$, if I want to associate a stack, I  would start with simpler cases which allows me to guess how to define.

*

*Given a Lie group $G$, I have stack associated to it, denoted by  $BG$, the stack of principal $G$ bundles.


*Given a manifold $M$, I have the stack associated to it, denoted by $\underline{M}$ whose objects are maps $Y\rightarrow M$.
Suppose $X$ is trivial and $G$ acts trivially on $X=\{*\}$ then $[X/G]$ should only depend on $G$. We know what stack to associate for a Lie group $G$ i.e., $BG$. Thus, $[X/G]$ should just be $BG$.
Suppose $G$ is trivial and $G$ acts on $X$, $[X/G]$ should only depend on $X$. We know what stack to associate for a manifold $X$ i.e., $\underline{X}$. Thus, $[X/G]$ should just be $\underline{X}$.
Suppose $G$ is non trivial and $X$ is non trivial and that the action of $G$ on $X$ is such that $X/G$ is a manifold. We know what stack to associate for a manifold $X/G$ i.e., $\underline{X/G}$. Thus, $[X/G]$ should just be $\underline{X/G}$.
I am not able to guess how could we guess the definition knowing above three cases. Is quotient stack definition motivated from these simpler cases or Is it the case that simpler cases are special cases of notion of Quotient stack. How could we come up with such a definition. Any comments regarding the motivation are welcome.
 A: Let me detail the following case: $G$ is a Lie group that acts freely and properly on the manifold $X$. Classical theorems in differential geometry state that the quotient is a manifold and that $X\rightarrow X/G$ is a principal $G$-bundle. Then as I said in the comments, given a principal $G$-bundle $P\rightarrow Y$ and a $G$-equivariant map $f:P\rightarrow X$ then at the quotient $f$ induces a map $g:Y\rightarrow X/G$, simply because $P/G=Y$.
Conversely, again in this situation for the action of $G$, let's take a map of manifolds $g:Y\rightarrow X/G$. Since the bundle $X\rightarrow X/G$ is locally trivial one can lift locally on $Y$ the map $g$ to a map $U\times G \rightarrow X$ (with $U\subset Y$) which is $G$-equivariant, seeing $U\times G$ as a trivial principal $G$-bundle. Such a lift is not unique: you can change it by an automorphism of the principal $G$-bundle $U\times G$. Glueing these lifts defines a principal $G$-bundle $P$ over $Y$ together with a $G$-equivariant map $P\rightarrow X$ lifting $g$. This corresponds exactly to the descent theory for principal $G$-bundles.
Let me add also that the theory of stacks is made so that, without any assumption on the action of $G$, $X\rightarrow [X/G]$ should be a principal $G$-bundle. More precisely, this means that for any map $Y\rightarrow [X/G]$, the fiber product in the category of stacks $Y\times_{[X/G]} X$ is in fact a manifold $P$ and that the projection $P\rightarrow Y$ is a principal $G$-bundle (in other words the principal $G$-bundle $X\rightarrow [X/G]$ pulls back to a principal $G$-bundle $P\rightarrow Y$ in the usual sense). This is the standard way of defining geometric conditions for stacks and morphisms between them: by pulling it back along a map from a manifold. This forces you again to take this definition for the stack $[X/G]$.
A: The nicest possible action of $G$ on $X$ is the free one, because in this case the quotient $X/G$ is a manifold or not far from a manifold, the map $X\to X/G$ is a $G$-principal bundle, and $G$-equivariant geometry on $X$ is the same as geometry on $X/G$. In short, the situation is as nice as possible.
The construction of the quotient stack $[X/G]$ is motivated by the desire to obtain such good properties in the non-free case also. Let me try to show how the definition of $[X/G](Y)$ comes naturally, say in the case that $Y$ is a point for simplicity. For this, we make the following observation. Fundamentally the quotient of a space by a group action is the set of orbits. Now if you think about it, an orbit is nothing else than the image of an equivariant map $f:P\to X$ where $P$ is a principal homogeneous space (a.k.a. a $G$-bundle), and we have a free orbit exactly when $f$ is injective. What is special with the case when $G$ acts freely on $X$ is that in this case any map $f$ as above has to be injective. But if you change slightly your conception of an orbit and if instead of the image $f(P)$, you focus on $P$ itself (understood with its mapping to $X$), then you somehow restore all good properties of free orbits — indeed, after all the action on $P$ is free! Therefore if we call orbit an equivariant map from a $G$-bundle to $X$, then $[X/G]$ is just the set of orbits. Now deriving the definition for fibrations over a general space $Y$ is easy.
A: Let's start approaching the question from the simplest possible case $Y=*$. What should be the points of $[X/G]$?
Recall that the idea here is to generalize the construction of the action groupoid for discrete groups acting on sets to the manifold case. This allows us to remember the stabilizers of points and it is generally a much better behaved notion.
So morally $[X/G](*)$ should be the groupoid whose objects are points of $X$ and such that $\mathrm{Mor}(x,x')=\{g\in G\mid gx=x'\}$. With this description however it is a bit unclear how to generalize that to get a description of $[X/G](Y)$, so let us rewrite it in a slightly different way.
A point of $X$ is just a $G$-equivariant morphism $G\to X$ (since any such $G$-equivariant morphism is determined by the image of $e\in G$). Moreover a morphism between $x:G\to X$ and $x':G\to X$ is exactly a $G$-equivariant morphism $g:G\to G$ (i.e. right multiplication by some element $g\in G$) making the obvious diagram commute. Now if you look at the definition, the groupoid does not depend from the fact that $G$ has a canonical basepoint (the identity element $e\in G$), so in fact we can write

$[X/G](*)$ is defined as  the groupoid of $G$-equivariant maps $T\to X$ where $T$ is a freely transitive $G$-space.

Ok, so now we want to describe the groupoid $[X/G](Y)$. Intuitively the objects here should be families of elements of $[X/G](*)$ parametrized by $Y$. But a family of freely transitive $G$-spaces is exactly a principal $G$-bundle $P\to Y$, and a family of $G$-equivariant map $P_y\to X$ for each $y\in Y$ is just a $G$-equivariant map $P\to X$. Hence we get the definition you are asking about.
A: Given a Lie group action $G$ on $X$ we have what is called a action groupoid  (Translation groupoid) associated with the action usually denoted by $G\ltimes X$. 
Objects of this category are elements of $X$. Given $x,y\in (G\ltimes X)_0=X$, there is an arrow $x\rightarrow y$ if these two elements $x,y$ are related by an element of $G$ i.e., if there exists $g\in G$ such that that $g.x=y$. We can also write 
$$\text{Mor} (x,y)=\{g\in G:g.x=y\}$$ 
So, we have a Lie groupoid $\mathcal{G}=G\ltimes X$ associated with this action $G$ on $X$. 
There is a notion of what is called a principal $\mathcal{G}$ bundle for a groupoid $\mathcal{G}$. 
I mentioned that, for each Lie group $G$ there is a stack $BG$, for each manifold $M$ there is a stack $\underline{M}$. 
I somehow forgot to mention that, for each Lie groupoid $\mathcal{G}$ there is a stack associated namely $B\mathcal{G}$, the category of principal $\mathcal{G}$ bundles. 

A principal $\mathcal{G}$ bundle over a manifold $M$ is a surjective submersion $\pi:P\rightarrow M$ with an action of $\mathcal{G}$ on $P$ (which comes with a map $a:P\rightarrow \mathcal{G}_0$) such that 
  
  
*
  
*$\pi:P\rightarrow M$ is $\mathcal{G}$ invariant 
  
*the map $P\times_{\mathcal{G}_0}\mathcal{G}_1\rightarrow P\times_MP$ given by $(p,g)\mapsto g.p$ is an diffeomorphism. 
  

This definition can be found online and in particular in the paper Orbifolds as Stacks by Eugene Lerman.
The category of these principal $\mathcal{G}$ bundles is  denoted by $B\mathcal{G}$. This is a stack associated to $\mathcal{G}$.
Now, consider the case when $\mathcal{G}=G\ltimes X$. Object space is $X$ here. So, principal bundle comes with map $P\rightarrow X$. As mentioned above, it comes with map $P\rightarrow M$ which is $\mathcal{G}$ invarinat. As $\mathcal{G}_1=G$, this simply mean $P\rightarrow M$ is a principal $G$ bundle (neglecting some technicalities). 
Thus, given a manifold $M$, the category $B\mathcal{G}(M)$ is a collection of principal $\mathcal{G}$ bundles over the base $M$. Thus objects are principal $\mathcal{G}$ bundles over $M$ which comes with map $P\rightarrow \mathcal{G}_0$ (anchor map) and $P\rightarrow M$ (projection map). In case when $\mathcal{G}=G\ltimes X$, this comes with map $P\rightarrow X$ and $P\rightarrow M$ such that $P\rightarrow M$ is $\mathcal{G}$ bundle and $P\rightarrow X$ is $\mathcal{G}$-equivariant. 

$B\mathcal{G}(M):=\{P\xrightarrow{p} M, P\xrightarrow{f}M | P\rightarrow M \text{ is a } \mathcal{G}-\text{bundle,}  ~ f  \text{ is } \mathcal{G}\text{-equivariant}\}$. 

This is precisely the definition for quotient stack.

$[X/G](Y):=\{P\xrightarrow{p} Y, P\xrightarrow{f}X | P\rightarrow Y \text{ is a G-bundle,}  ~ f  \text{ is } G\text{-equivariant}\}$. 

This is (may be) the (one of) motivations for the definition of Quotient stack.


*

*If action of the Lie group $G$ on the manifold $X$ is free and proper, what we get is   a manifold $X/G$. Stack associated to this manifold is $\underline{X/G}$ which we call to be the quotient stack, denote by $[X/G]$.

*If the action of the Lie group $G$ on the manifold $X$ is not necessarily free and proper, what we get is   a Lie groupoid denoted (among other symbols) by $X//G$. Stack associated to this Lie groupoid $X//G$ is $B(X//G)$ which we call to be the quotient stack, denote by $[X/G]$.
