Yoneda Embedding and pull back 
*

*Given a manifold $M$ we have a geometric stack associated to it namely $\underline{M}$ whose objects are smooth maps to $M$. For the sake of consistency I am writing $BM$ for $\underline{M}$.

*Given a Lie group $G$ we have a geometric stack associated to it namely $BG$ whose objects are principal $G$ bundles.

*Given a Lie groupoid $\mathcal{G}$ we have a geometric stack associated to it namely $B\mathcal{G}$ whose objects are principal $\mathcal{G}$ bundles.
These are called as Yoneda embedddings (I do not have precise reference where it is called so, except for manifolds corollary $4.16$). 
Given a smooth map $f:M\rightarrow N$, if it is a submersion, then, $M\times_NM$ is a manifold. We have $2$-fibre product $\underline{M}\times_{\underline{N}}\underline{N}$ and the stack $\underline{M\times_NM}$.
I am able to see  that $\underline{M\times_NM}\cong \underline{M}\times_{\underline{N}}\underline{M}$.  We have $B(M\times_NM)\cong BM\times_{BN}BN$.
David Roberts say here  that same holds in case of Lie groups and Dimitri Pavlov say  here  that same holds for Lie groupoids i.e., we have following.


*

*Given a morphism of Lie groups $\theta:G\rightarrow H$ which is a surjective submersion (submersion is to ensure $G\times_H G$ is a Lie group), then $$B(G\times_HG)\cong BG\times_{BH}BG.$$

*Given a morphism of Lie groupoids $f:\mathcal{G}\rightarrow \mathcal{H}$ such  that  the fibered product  (in page no $5$, section $2.3$)  $\mathcal{G}\times_{\mathcal{H}}\mathcal{G}$ is a Lie groupoid, then $$B(\mathcal{G}\times_{\mathcal{H}}\mathcal{G})\cong B\mathcal{G}\times_{B\mathcal{H}}B\mathcal{G}$$
Dmitri Pavlov said here that this has something to do with Preservation of limits by the Yoneda embedding and suggested this and this. But I am not familiar with $(\infty,1)$ categories. So, I am asking here (I am asking as a separate question).

How does one see that Yoneda embedding preserves limits in this setup? Please see my answer, I see the case in classical category theory.

Just an outline is also ok, just that it would be good if it is not mixed with $(\infty,1)$ categories.
 A: In an arbitrary category $C$, if a functor $F: I\to C$ has a limit $L$ with projections $\pi_i, i\in \mathrm{Ob}(I)$, then we have a natural (in $X$) isomorphism in $\hom_C(X, L)\to \lim_i\hom_C(X,F(i))$. 
In fact, this is better stated as : $(\pi_i\circ - :  \hom_C(X,L)\to \hom_C(X, F(i)))_i$ is a limite cone. 
Now if $I$ is small, $\mathbf{Set}^I$ makes sense, and limits in this category are computed pointwise, so that $(\pi_i\circ - :  \hom_C(-,L)\to \hom_C(-, F(i)))_i$ is a limit cone in $\mathbf{Set}^I$ (a limit cone of functors). 
What this says, with less precision on which maps we use, is $\hom_C(-,\lim F) \simeq \lim_i\hom_C(-,F(i))$. 
But the Yoneda embedding is precisely $y : A\mapsto \hom_C(-,A)$, $f\mapsto f\circ -$ (for it to make sense as a functor we have to make sense of $\mathbf{Set}^C$, which can be problematic if $C$ isn't small, but let's not think about that), so what we said above can be restated : $y$ sends limit cones to limit cones, or again with less precision on the maps $y(\lim F) \simeq \lim y\circ F$, which is exactly the definition of preserving limits. 
Now to prove the claim about the limit cone : let $(A,(p_i))$ be any cone over $i\mapsto \hom_C(X,F(i))$ in $\mathbf{Set}$. Fix $a\in A$. Then $(p_i(a))_i$ is a family of maps, and since $(p_i)$ is a cone, for each $f:i\to j$ it satisfies $\hom_C(X,F(f))(p_i(a)) = p_j(a)$, so $F(f)\circ p_i(a) = p_j(a)$. 

Thus $(p_i(a))_i$ is actually a cone over $F$ with domain $X$; so it factors uniquely through some $p(a) : X\to L$, we then have $\pi_i\circ p(a) = p_i(a)$, in other words $(\pi_i\circ -)(p(a)) = p_i(a)$. 
Define $p:A\to \hom_C(X,L)$ this way, and then the above equation tells us $(\pi_i\circ -)\circ p = p_i$, which tells us exactly that our initial cone factors through the intended one. It's not hard to check that this factorization is unique; so it is indeed a limit cone.
As stated, this has nothing to do with homotopy limits and $(\infty, 1)$-categories, though. 
A: Let $F:\mathcal{I}\rightarrow \mathcal{C}$ is a functor. This is also called as diagram indexed by $\mathcal{I}$. 
By the Limit of this diagram, we mean an object (universal ) 
$L$ of $\mathcal{C}$ and a collection of arrows (universal again) $\pi_i:L\rightarrow F(i)$ such that, for each arrow $m:i\rightarrow j$ in $\mathcal{I} $ the following diagram is commutative.
This is usually denoted by $\varprojlim_{\mathcal{I}}F(i)$ or simply by $\varprojlim_{\mathcal{I}}F$. 

Fixing an object $X$ in $\mathcal{C}$,
I want to prove that 
$$\varprojlim_{\mathcal{I}}(\text{Hom}_{\mathcal{C}}(X,F(i)))
=\text{Hom}_{\mathcal{C}}(X,\varprojlim_{\mathcal{I}}F(i))$$
i.e., an isomorphism 
$$\varprojlim_{\mathcal{I}}(\text{Hom}_{\mathcal{C}}(X,F(i)))
=\text{Hom}_{\mathcal{C}}(X,L)$$ Let $(A,(p_i))$ be cone for the functor $\mathcal{I}\rightarrow \text{Set}$ given by $i\mapsto \text{Hom}_{\mathcal{C}}(X,F(i))$ i.e., we have following commutative diagrams

To prove that $\text{Hom}_{\mathcal{C}}(X,L)$ is equal to $\varprojlim_{\mathcal{I}}(\text{Hom}_{\mathcal{C}}(X,F(i)))$ it suffices to prove that there exists unique arrow $p:A\rightarrow \text{Hom}_{\mathcal{C}}(X,L)$ such that the following diagram is commutative.

So, we define an arrow $p:A\rightarrow \text{Hom}_{\mathcal{C}}(X,L)$ i.e., given $a\in A$ we define  arrow $p(a):X\rightarrow L$ in $\mathcal{C}$. How to one get such arrow? See above diagram. 
For each $a\in A$, we have $p_i(a):X\rightarrow F(i)$ such that $F(m)\circ p_i(a)=p_j(a)$ giving following diagram which gives an arrow $X\rightarrow L$ by universal property

This is the $p(a):X\rightarrow L$ that we associate for each $a\in L$. 
This gives the map $p:A\rightarrow \text{Hom}_{\mathcal{C}}(X,L)$ satisfying conditions mentioned above. Thus, we have 
$$\varprojlim_{\mathcal{I}}(\text{Hom}_{\mathcal{C}}(X,F(i)))
=\text{Hom}_{\mathcal{C}}(X,L)=\text{Hom}_{\mathcal{C}}(X,\varprojlim_{\mathcal{I}}F(i))$$
Consider the functor $\text{Man}\rightarrow \text{Stacks}$ that sends $M$ to $\underline{M}$ which is precisely $\text{Hom}(-,M)$.
Let $M_1,M_2,M_3$ be manifolds and $M_1\rightarrow M_2,M_3\rightarrow M_2$ be arrows. 
We have $\varprojlim M_i = M_1\times_{M_2}M_3$. We have $$\text{Hom}(-,\varprojlim M_i)=\varprojlim \text{Hom}(-,M_i)$$
$$\underline{M_1\times_{M_2}M_3}=\text{Hom}(-,M_1\times_{M_2}M_3)=\varprojlim \underline{M_i}=\underline{M_1}\times_{\underline{M_2}}\underline{M_3}$$
