I've always felt that in proving that co/ends are co/limits, Mac Lane's CWM makes use of a category apparently coming out of nowhere.

Let $C$ be a category; I define the *subdivision graph* of $C$ to be the digraph having a vertex $c^\S$ for each object $c\in C$, and a vertex $f^\S$ for each morphism $f : c\to c'$ in $C$, and edges all the arrows $s(f)^\S \to f$ and $t(f)^\S \to f^\S$, as $f$ runs over morphisms of $C$.

Formally adding identities, and taking the trivial function as composition law (so that $u\circ v$ is only defined when at least one arrow is an identity) turns the subdivision graph of $C$ into a category, the *subdivision category of $C$*.

Now, you can say many things about this definition, but certainly not that it is easy to see where it comes from: Mac Lane himself stresses how outside of page 220 (1st edition), where it is used to show that every functor $F : C°\times C\to D$ induces a functor $F^\S : C^\S \to D$, and the end of $F$ is the limit of $F^\S$, there will be no other mention of $C^\S$. So

where does this definition come from? What is the intuition behind it? How did Mac Lane (or whoever else mentioned it first) come up with it?

thiscategory is cooked up precisely so as to make the theorem true. But as Tim's answer points out, there are alsoothercategories that suffice to make the same theorem true and that are lessad hoc. $\endgroup$ – Mike Shulman Sep 4 '19 at 3:24other: afaicu what Tim is pointing out is that you can consider the subdivision category as the image of $C$ under a functor, but this functor is better appreciated at the level of $\infty$-categories, because at that level it's a subdivision functor $$X\mapsto \text{sd}(X) = \int^n X_n\times N([n]\cup [n]^{op} )$$ $\endgroup$ – Fosco Sep 5 '19 at 21:46