The connection can be made precise via the notion of compact closure for symmetric monoidal structures.

Recall that a symmetric monoidal category $C$ is **compact closed** if every object $c$ has a right adjoint $c^\ast$, meaning that there are unit and counit arrows $\eta: I \to c^\ast \otimes c$ and $\varepsilon: c \otimes c^\ast \to I$ satisfying triangular equations ($I$ is the monoidal unit; the idea is that $c^\ast \otimes -$ is right adjoint to $c \otimes -$). The classical example is of course the category of finite-dimensional vector spaces: the counit $V \otimes V^\ast \to k$ is given by evaluation, and the unit $k \to V^\ast \otimes V$ takes the unit element $1 \in k$ to $\sum_i f^i \otimes e_i$ for any chosen basis $e_i$ and dual basis $f^i$.

In such a situation, there are various equivalent ways of considering morphisms $f: b \to c$. By the adjunction, they are in natural bijection with morphisms $I \to b^\ast \otimes c$. (I'll call this the 'right' picture.) By taking advantage of the symmetry of the tensor, it's also true that one can switch things around and give an adjunction $c^\ast \dashv c$, and thus morphisms $f: b \to c$ will also be in natural bijection with morphisms $b \otimes c^\ast \to I$ (the 'left' picture). Also in this situation, one can define an abstract trace of an endomorphism $f: b \to b$ by the formula

$$Tr(f) = (I \stackrel{unit}{\to} b \otimes b^\ast \stackrel{f \otimes 1_{b^\ast}}{\to} b \otimes b^\ast \stackrel{counit}{\to} I)$$

which returns the classical trace for endomorphisms on a finite-dimensional vector space. Continuing with this, the composition of two morphisms in the right picture, say $f: I \to b^\ast \otimes c$ and $g: I \to c^\ast \otimes d$, is obtained by 'tracing out':

$$I \stackrel{f \otimes g}{\to} b^\ast \otimes c \otimes c^\ast \otimes d \stackrel{1_{b^\ast} \otimes \varepsilon \otimes 1_d}{\to} b^\ast \otimes d$$

which is to say composing with the counit in a tensor sandwich.

Now, the bicategory of small categories and profunctors is a compact closed *bicategory*, meaning that it is a symmetric monoidal bicategory (the tensor being given at the object level by taking cartesian products), and every object $C$ has a right biadjoint, which turns out to be $C^{op}$. If we think of a profunctor from $C$ to $D$ as essentially the same thing as a cocontinuous functor

$$Set^{C^{op}} \to Set^{D^{op}},$$

then the unit $1 \to C^{op} \otimes C$ in $Prof$ corresponds to the unique (up to iso) cocontinuous functor

$$Set \to Set^{C^{op} \times C}$$

that sends the terminal object $1$ to $\hom_C$. The counit $C \otimes C^{op} \to 1$ corresponds to a cocontinuous functor

$$Set^{C \times C^{op}} \to Set$$

which sends a functor $F: C \times C^{op} \to Set$ to the coend $\int^c F(c, c)$. Thus, composition of profunctors in the right picture will involve a tracing out by applying a coend operation to the middle two factors.

reallyunderstanding co-ends (and even partial traces for that matter!) can shed some light on things. $\endgroup$ – Aleks Kissinger Mar 29 '11 at 0:32