Each loreal pit contains a thin membrane stretched across an air-filled cavity, densely innervated by terminals of the trigeminal nerve. Ion channels in those terminals, notably TRPA1, open in response to small increases in temperature, so warm objects in front of the snake produce a spatial pattern of firing.
The geometry does the imaging. The pit opening acts as a crude pinhole, projecting a coarse thermal image onto the membrane; two pits give overlapping fields and hence directional information. In the optic tectum this input is integrated with visual input, so the snake's representation of a warm mouse is built from both senses at once.
Sensitivity is high enough to detect temperature differences well below a degree, which is what allows a strike at a rodent in a lightless burrow. Boas and pythons evolved separate heat-sensing pits independently, with different anatomy. The resolution actually achieved by a live snake, as opposed to the theoretical limit of the optics, is not precisely known.

