Most objects emit or reflect photons somewhat randomly in a range of directions. Many materials will react to photons hitting them from any direction within a certain range. The probability that a particular point on one object will in some period of time emit a photon that is directed perfectly toward some particular point on another object is generally small [how small depends on the sizes of the "points" in question, but for infinitesimal points the probability is infinitesimal], but the probability that the object will emit a photon that will come "close" to hitting a particular point in space can be much larger (the greater the tolerance, the greater the probability).
The purpose of focusing optics is to make it so that a significant fraction of the photons which are emitted from some point on an object will have a significant probability of being directed through a particular point in space associated with that point on the object. For simplicity, assume a two-dimensional world and consider a lens with a nearly infinite coefficient of refraction which is almost infinitesimally thin and has nearly-flat sides, oriented vertically along the Y axis, positioned so that any light which enters along the X axis will pass through and continue along the X axis. Imagine further that a bunch of photons leave from a point on an object which is on the axis (i.e. its Y coordinate is zero), and proceed to strike the lens.
The slope of every such photon which hits the lens will be equal to the change in Y coordinate where it left the object to where it hits the lens, divided by the change in X coordinate. If the object is at (Xo,0) and it hits the lens at (0,Yi) the slope will be -Yi/Xo. To make all such photons strike a common point (0,Xf) on the X axis on the other side of the lens, they must leave with a slope which is equal to -Yi/Xf (note that the Xf and Xo have opposite sign, so the slopes do likewise). Focusing lenses work by changing the slope of the photons passing through them by an amount which is proportional to the distance from the axis. The amount by which the lens changes focus when hit at position (0,Yt) is -Yi/Xf-(-Yi/Xo), or Yi/Xo-Yi/Xf.
If light originates at (Xo,Yo) then any light which strikes the lens at position Yi will have a slope of (Yo-Yi)/Xo [it traveled a vertical distance of (Yi-Yo) and a horizontal distance of -Xo]. It will thus leave the lens with a slope of (Yo-Yi/Xo)+(Yi/Xo-Yi/Xf), which is to say (Yo/Xo-Yi/Xf). After traveling a horizontal distance Xf, it will travel a vertical distance of Yi, meaning that its Y coordinate will be Yi+Xf(Yo/Xo-Yi/Xf), which is equal to Yi+XfYo/Xo-Yi, or simply XfYo/Xo. Note that the Y coordinate at which the photon hits the lens does not affect its Y coordinate when it is distance Xf from the lens.
The fact that a significant fraction of the photons which depart from a particular spot on the object will pass through an associated point some distance from the lens means that the number of photons that would strike a target placed at that spot would be proportional to the amount which leave from the corresponding origin point, thus making it possible to estimate how many photons are leaving the origin point by determining how many strike the target.