Picture a completely black room with only a single point of light, sending out rays in all directions.
Somewhere else in the room is a camera, pointed at that point of light. Now if you think about the front element of the lens of that camera, and all the light rays leaving that point of light hitting it, you can imagine that there’s a solid cone of light going from the point of light to that lens (all the other light is being lost, let’s say).
What is happening to that light once it hits that front element of the lens? Well, in a compound lens like an SLR camera lens, the light rays that make up that cone are going into the lens, where they get refracted and shaped into a column, maybe there are multiple stages inside the lens shaping it into a smaller column or whatever, and it goes through the aperture in the lens (the size of which corresponds to whatever f-stop is set) at some point, and then comes out the back element.
The lens is designed so that the disc of light hitting the back element comes out and forms another solid cone of light. (Of course, where the light converges to a point at the tip of this cone, it just continues on through, so it spreads out again into another cone that just disperses, growing infinitely with no base…at least until it hits something.)
Now, you can imagine that floating point of light in front of the camera moves up in the frame, what happens to the point of the cone behind the camera? It moves down. If the point in front moves left, the point coming out the back moves right.
Where is the sensor in all this? Well, if you put the sensor behind the camera it will collect whatever light falls on it. You could position it so that it cuts off the cone somewhere and you get a blob of light on it. But, remember, you’re trying to make an image of what’s in front of the camera, which is a single point of light. So, you should position the sensor right where that cone of light converges to a single point—boom, you have an “in focus” image of your point of light!
However, you can’t move the sensor closer or farther from the back of the lens. So, in order to focus it such that the cone coming out the back converges right where the sensor is, you could move the point closer or farther from the front element. Just like when it moves left/right or up/down, moving closer or farther from the camera changes the cone coming out the back.
Or, if you actually want people to buy your device, the lens can be designed to let you shape that cone coming out the back so you can focus it without moving the sensor or the point of light in front of the camera, which is exactly how lenses are designed.
Now that you can picture how a single point of light is focused, you can easily imagine how two points of light would work. Notice that if you focus on one of them, unless the other one is in the same focal plane, the cone it corresponds to coming out the back of the lens will converge either behind or in front of the sensor—it will be out of focus.
Finally, just realize that when you have a real scene in front of the camera, that’s just a whole lot of single points of light jammed really close together, each one at a different distance from the lens. When you focus the lens, you’re choosing one focal plane out in front of the lens, and only the points of light in that focal plane will converge to a point on the sensor. All of the points that are farther or closer to the lens will have their corresponding light cones hit the sensor before they converge, or after, and they’ll appear as out of focus blobs.
Latest Answers