In general, limits and colimits do not commute.
It is therefore of interest to list the special conditions under which certain limits do commute with certain colimits.
This page lists some of these.
For $C$ a small filtered category, the functor $colim_C : [C,Set] \to Set$ commutes with finite limits.
More in detail, let
$C$ be a small filtered category
$D$ be a finite category (or more generally an L-finite category);
$F \colon C \times D^{op} \to Set$ a functor;
then the canonical morphism
is an isomorphism.
In fact, $C$ is a filtered category if and only if this is true for all finite $D$ and all functors $F : C \times D^{op} \to Set$.
Similarly to the example of filtered limits, for $C$ a small sifted category, the functor $colim_C : [C,Set] \to Set$ commutes with finite products. In fact, this is usually taken to be the definition of a sifted category, and then a theorem of Gabriel and Ulmer characterizes sifted categories as those for which the diagonal functor $C \to C \times C$ is a final functor.
For more on this see at distributivity of products and colimits.
More precisely, if $G$ is a finite group, $C$ is a small cofiltered category and $F : C \to G-Set$ is a functor, the canonical map
is an isomorphism. This fact is mentioned by André Joyal in Foncteurs analytiques et espèces de structures; a proof can be found here.
Let $A$ be a set, $C$ a connected category, and $F \colon C\times A \longrightarrow Set$ a functor. Then the canonical morphism
is an isomorphism. This remains true if Set is replaced by any Grothendieck topos.
More generally, if $\mathbf{H}$ is an (∞,1)-topos, $A$ is an n-groupoid, and $C$ is a small (∞,1)-category whose classifying space is n-connected, then $C$-limits commute with $A$-colimits in $\mathbf{H}$. This follows from the fact that the colimit functor $\mathbf{H}^A\to\mathbf{H}$ induces an equivalence of (∞,1)-topoi $\mathbf{H}^A\simeq \mathbf{H}_{/A}$. For example, if $C$ is a cofiltered (∞,1)-category or even a cosifted (∞,1)-category, then the classifying space of $C$ is weakly contractible and hence $C$-limits commute with $A$-colimits in $\mathbf{H}$ for any ∞-groupoid $A$.
In general, for any class of limits $\Phi$, one may consider the class of all colimits that commute with $\Phi$-limits and dually. These classes of limits and colimits share many of the properties of the above examples, especially when $\Phi$ is a sound doctrine.
Let $C$ be a category with pullbacks and colimits of shape $D$.
We say that colimits of shape $D$ are stable by base change or stable under pullback or that these colimits are universal if for every functor $F : D \to C$ and for all pullback diagrams of the form
the canonical morphism
is an isomorphism.
Beware that (2) is an example of the commutativity formula (1) only if the colimit over $D$ of the diagram constant on a single object (such as $Y$) is that single object. For ordinary colimits in category theory this is a mild condition, requiring $D$ to be a connected category; but in higher category theory this becomes an ever stronger condition. For instance for colimits in an (infinity,1)-category it means that the infinity-groupoid generated by $D$ is contractible homotopy type (see this corollary).
Instead, generally (2) is an example of distributivity of limits over colimits, see there.
All colimits are stable under base change (2) in the following categories $C$:
but not in for instance
Remark
In topos theory and (∞,1)-topos theory one says that colimits are universal if they are preserved under pullback.