How do snakes determine the direction of prey from their thermal infrared sensing pit organs?
From Wikipedia:

The facial pit actually visualizes thermal radiation using the same optical principles as a pinhole camera, wherein the location of a source of thermal radiation is determined by the location of the radiation on the membrane of the heat pit. However, studies that have visualized the thermal images seen by the facial pit using computer analysis have suggested that the resolution is extremely poor

Individual pit organs act like pinhole cameras because they are arranged, well, like a pinhole camera: there is an invagination of tissue surrounded by heat-sensitive cells with a smaller hole to the outside world. From Sichert et al 2006 it looks like this:

The dashed lines here indicate heat originating from some distant point source. That point source covers some fraction of the heat-sensitive membrane. Points at different distances and directions will be picked up on different parts of the heat-sensitive membrane. For example, because this source is coming from below, only the top of the pit is illuminated; for a source coming from above, only the bottom of the pit would be illuminated, etc.
If you have access to the Sichert paper, they go into more detail about the mathematics that the pit organ geometry creates. In summary, for any cell you can map a receptive field of places in the world that can project to that spot, and through a summation of these receptive fields across the whole pit organ you can reconstruct a map of where heat is originating. At that point, the principles are no different from visual organs like the retina. The authors show that even with each individual detector having imprecise resolution, the combined activity can be decoded to form a clear image from a simple linear combination of the receptive fields.
Other studies like Chen et al 2012 show that vipers integrate retinal vision with their pit organ senses, because occluding a pit on one side and an eye on the other is worse for prey targeting success than occluding both on the same side. Neuronal evidence of this integration has been observed for quite some time, see for example Newman &amp; Hartline, 1981.
Bothe et al 2019 is a more recent paper investigating some of the neural circuitry behind the processing of pit organ information and integration with vision.

Bothe, M. S., Luksch, H., Straka, H., &amp; Kohl, T. (2019). Neuronal substrates for infrared contrast enhancement and motion detection in rattlesnakes. Current Biology, 29(11), 1827-1832.
Chen, Q., Deng, H., Brauth, S. E., Ding, L., &amp; Tang, Y. (2012). Reduced performance of prey targeting in pit vipers with contralaterally occluded infrared and visual senses. PLoS One, 7(5), e34989.
Newman, E. A., &amp; Hartline, P. H. (1981). Integration of visual and infrared information in bimodal neurons in the rattlesnake optic tectum. Science, 213(4509), 789-791.
Sichert, A. B., Friedel, P., &amp; van Hemmen, J. L. (2006). Snake’s perspective on heat: reconstruction of input using an imperfect detection system. Physical review letters, 97(6), 068105.