When is a category the colimit of its slice categories My question: is it true in general for a small category $\mathcal{C}$ that the canonical functor
\begin{aligned}
\operatorname{colim}_{c\in \mathcal{C}}\mathcal{C}/x \to \mathcal{C}
\end{aligned}
is an equivalence of categories? If so, is there a canonical way of seeing this without explicitly constructing an inverse?

Let me explain the statement in more detail. For an object $x$ in $\mathcal{C}$, let $C/x$ denote the over-category of $\mathcal{C}$ over $x$, with objects given by morphisms $f: y \to x$ in $\mathcal{C}$ and morphisms from $f: y \to x$ to $f': y'\to x$ given by morphisms $g: y \to y'$ in $\mathcal{C}$ such that $f = f' \circ g$. These over-categories assemble into a functor
\begin{aligned}
\mathcal{C} \to \operatorname{Cat}: c \mapsto \mathcal{C}/x
\end{aligned}
to the (large) category of small categories. Indeed, for a morphism $h: x \to x'$, we get a functor $\mathcal{C}/x \to \mathcal{C}/x': (f: y \to x) \mapsto (h \circ f: y \to x')$.
For every $x$, there is a canonical functor source functor $s: \mathcal{C}/x\to \mathcal{C}$ given by sending $f: y \to x$ to its source $y$. Essentially by definition, these source functors assemble into a cocone over $\mathcal{C}$ in $\operatorname{Cat}$, and thus give rise to a functor
\begin{aligned}
\operatorname{colim}_{c\in \mathcal{C}}\mathcal{C}/x \to \mathcal{C}.
\end{aligned}
This is the canonical functor referred to in the statement above.
Attempt: one can try to simply write down an inverse functor $\mathcal{C} \to \operatorname{colim}_{c\in \mathcal{C}}\mathcal{C}/x$ as follows. An object $x$ is sent to the object in the colimit system represented by the object $(\operatorname{id}_x: x \to x)$ in $\mathcal{C}/x$. If $f: x \to x'$ is a morphism in $\mathcal{C}$, notice that this object $(\operatorname{id}_x: x \to x)$ gets identified in the colimit system with the object $(f: x \to x')$ in $\mathcal{C} / x'$. Also notice that $f: x \to x'$ forms a morphism in $\mathcal{C}/x'$ from $(f: x \to x')$ to $\operatorname{id}_{x'}: x' \to x'$. It thus seems that the assignment $x \mapsto [\operatorname{id}_x: x \to x]$ extends to a functor $\mathcal{C} \to \operatorname{colim}_{c\in \mathcal{C}}\mathcal{C}/x$. I think this should be the desired inverse.
Question: Does the above proof attempt work? If so, is there a more invariant way of proving that the canonical functor is an equivalence? I am interested in a version of the statement for $\infty$-categories, for which one cannot simply write down an inverse functor by giving what it does on objects and morphisms.
 A: Apparently I confused myself. The claim is true for both the strict colimit and the pseudo colimit, as you realised.
Consider the codomain projection $\operatorname{codom} : [\mathbf{2}, \mathcal{C}] \to \mathcal{C}$.
This is a Grothendieck opfibration whose fibres are the slice categories $\mathcal{C}_{/ x}$ as $x$ varies, and the opcartesian morphisms are the ones whose domain part is an isomorphism.
There is a canonical splitting, exhibiting this as the Grothendieck construction of the diagram $x \mapsto \mathcal{C}_{/ x}$ you are interested in.
It is a general fact that the Grothendieck construction of a diagram is its oplax colimit, and one obtains the pseudo colimit by inverting the opcartesian morphisms.
Proposition. The domain projection $\operatorname{dom} : [\mathbf{2}, \mathcal{C}] \to \mathcal{C}$ is a localisation functor.
Proof. The domain projection is the right adjoint of the functor $\mathcal{C} \to [\mathbf{2}, \mathcal{C}]$ that sends each object $x$ to $\textrm{id}_x : x \to x$. The latter is fully faithful, so the domain projection is a coreflector. But reflectors are automatically localisation functors, so we are done. ■
Corollary. The pseudo colimit of $x \mapsto \mathcal{C}_{/ x}$ is equivalent to $\mathcal{C}$ via the canonical cocone. ■
The strict colimit can be constructed in a similar way: instead of inverting the opcartesian morphisms, we force them to be identity morphisms.
I am informed that similar general results hold in the setting of quasicategories, so the pseudo colimit version should translate directly.
A: At this point, I am quite sure that the statement is true (both in the sense of a strict colimit as well as in the more relevant sense of a pseudo colimit.) I'll give a proof below. Nevertheless, I'd be happy if someone could provide an alternative (shorter/more elegant) proof that has the hope of also providing a proof in the setting of $\infty$-categories.
Proof: We show that $\mathcal{C}$ has the universal property of the pseudo colimit. (To prove it has the universal property of the strict colimit, replace all appearing natural isomorphisms by identity transformations.)
So consider a collection of functors $F_x: \mathcal{C}/x \to \mathcal{D}$ into a small category $\mathcal{D}$ with natural isomorphisms
\begin{aligned}
\alpha_f: F_{y} \circ f_* \overset{\cong}{\implies} F_x
\end{aligned}
for all $f: x \to y$ in $\mathcal{C}$ satisfying

*

*$\alpha_{\operatorname{id}_x} = \operatorname{id}_{F_x}$

*$\alpha_{gf} = \alpha_g \circ \alpha_f$ for $f:x\to y$ and $g: y \to z$.

We now have to show that up to natural isomorphism there is a unique functor $F: \mathcal{C} \to \mathcal{D}$ with natural isomorphisms $\beta_x: F_x \overset{\cong}{\implies} F \circ s_x$ such that the two natural equivalences
\begin{aligned}
F_{y} \circ f_* \overset{\alpha_f}{\implies} F_x \overset{\beta_x}{\implies} F \circ s_x
\end{aligned}
and
\begin{aligned}
F_{y} \circ f_* \overset{f_*(\beta_y)}{\implies} F \circ s_y \circ f_* = F \circ s_x
\end{aligned}
are equal.
Existence: On objects, we define $F$ by
\begin{aligned}
F(x) := F_x(\operatorname{id}_x: x \to x).
\end{aligned}
On a morphism $f: x \to y$, we define $F(x)$ as the composite
\begin{aligned}
F(x): F_x(\operatorname{id}_x: x \to x) \xrightarrow[\alpha_f]{\;\;\cong\;\;} F_y(f_*(\operatorname{id}_x: x \to x)) \xrightarrow{F_y(f: f \to \operatorname{id})} F_y(\operatorname{id}_y: y \to y).
\end{aligned}
This forms a functor. Indeed, we see:

*

*We have $F(\operatorname{id}_x) = \operatorname{id}$ as $\alpha_{\operatorname{id}} = \operatorname{id}$ and $F_y(\operatorname{id}) = \operatorname{id}$.

*For $f: x \to y$ and $g: y \to z$, we have $F(gf) = F(g) \circ F(f)$. This can be seen by the following commutative diagram:
$\require{AMScd}$
\begin{CD}
F_x(\operatorname{id}: x \to x) @>{=}>> F_x(\operatorname{id}: x \to x) @>{=}>> F_x(\operatorname{id}: x \to x) \\
@V{\alpha_f}VV @V{\alpha_{gf}}VV @VV{\alpha_{gf}}V\\
F_y(f: x \to y) @>{\alpha_g}>> F_z(gf: x \to z) @>{=}>> F_z(gf: x \to z) \\
@V{F_y(f: f \to \operatorname{id})}VV @V{F_z(f: gf \to g)}VV @VV{F_z(gf: gf \to \operatorname{id})}V\\
F_y(\operatorname{id}: x \to y) @>>{\alpha_g}> F_z(g: y \to z) @>>{F_z(g: g \to \operatorname{id})}> F_z(gf: x \to z) \\\end{CD}
Here the left composite is $F(f)$, the bottom one is $F(g)$ and the right one is $F(gf)$.

Furthermore, we have natural isomorphisms $\beta_x: F_x \implies F \circ s_x$ of functors $\mathcal{C}/x \to \mathcal{D}$ by
\begin{aligned}
\beta_x: F_x(f: y \to x) = F_x(f_*(\operatorname{id}_x: x \to x)) \xrightarrow[\cong]{\alpha_f} F_y(\operatorname{id}_y: y \to y) = F(s_x(f)).
\end{aligned}
Since $\alpha$ is associative, it is clear that $\beta_x \circ \alpha_f = f_*(\beta_y)$. This finishes the proof of existence.
Uniqueness: We now assume that $G: \mathcal{C} \to \mathcal{D}$ is another functor with natural equivalences $\gamma_x: F_x \overset{\cong}{\implies} G \circ s_x$ satisfying $\gamma_x \circ \alpha_f = f_*\gamma_y$. We show that there is a natural isomorphism $\delta: F \overset{\cong}{\implies} G$.  On objects, this is given by the composite
\begin{aligned}
F(x) \xrightarrow[\cong]{\beta_x^{-1}} F_x(\operatorname{id}_x: x \to x) \xrightarrow[\cong]{\gamma_x} G(x).
\end{aligned}
Note that the relations $\beta_x \circ \alpha_f = f_*(\beta_y)$ and $\gamma_x \circ \alpha_f = f_*\gamma_y$ imply that for every morphism $f: x \to y$, this composite agrees with the composite
\begin{aligned}
F(x) = F(s_y(f:x \to y)) \xrightarrow[\cong]{\beta_y^{-1}} F_y(f: x \to y) \xrightarrow[\cong]{\gamma_y} G(s_y(f:x \to y)) = G(x).
\end{aligned}
The fact that these morphisms give a natural transformation follows from the following commutative diagram for every $f: x \to y$:
\begin{CD}
F(x) @>F(f)>> F(y) \\
@V{=}VV @VV{=}V \\
F(s_y(f:x \to y)) @>{F(s_y(f: f \to \operatorname{id}_y}))>> F(s_y(\operatorname{id}_y: y \to y)) \\
@V{\beta_y^{-1}}VV @VV{\beta_y^{-1}}V \\
F_y(f: x \to y) @>{F_y(f: f \to \operatorname{id}_y)}>> F_y(\operatorname{id}_y: y \to y) \\
@V{\gamma_y}VV @VV{\gamma_y}V \\
G(s_y(f:x \to y)) @>{G(s_y(f: f \to \operatorname{id}_y}))>> G(s_y(\operatorname{id}_y: y \to y))\\
@V{=}VV @VV{=}V \\
G(x) @>G(f)>> G(y)
\end{CD}
So $\delta: F \implies G$ is indeed a natural equivalence. Basically by definition of $\delta$, the composite $F_x \overset{\beta_x}{\implies} F \circ s_x \overset{\delta \circ s_x} G \circ s_x$ agrees with $F_x \overset{\beta_x}{\implies} G \circ s_x$, proving the uniqueness (up to isomorphism) of the functor $F: \mathcal{C} \to \mathcal{D}$ with its natural isomorphisms $\beta_x: F_x \cong F \circ s_x$.
