This video shows some good examples of a dolly zoom.

So, how does this work?

Imagine you're standing in one spot, and a person is 10 feet in front of you, a house is visible behind the person 100 feet in front of you, and a mountain is visible behind the house miles away from you.

Now consider what happens if you move 10 feet backwards. The person is now 20 feet away from you, so the distance to the person has doubled. But the distance to the house has only increased by 10%. And the distance to the mountain is negligbly larger than it was before.

That means that, from your point of view, the person now appears to be about half as large as they did before, while the house will only be about 10% smaller, and the mountain will have barely changed at all.

Now, imagine you look at the person through a camera, and you zoom in, so they look twice as large. The zoom affects everything equally, so everything gets twice as large. Now the person looks as large as they did before, but the house looks significantly larger than it did before, and the mountain looks almost twice as large.

Here's an interactive demo of that. There's a small red sphere close to the camera, a larger blue cube farther from the camera, and a very large green triangle very far away from the camera. The top half is a side view, showing the camera and its field of view. (The green triangle isn't visible, because it's ten times farther away from the camera than the blue cube.) The bottom half shows what the camera sees.

The sliders let you adjust the camera's position and zoom. You can see that when you adjust the zoom, the camera's field of view changes, and from the camera's point of view, the sphere, cube and triangle all grow and shrink proportionally. But when you move the camera, the apparent size of the sphere changes much more than the cube, and the triangle barely changes at all.

When you select a focus and move the distance slider, the zoom slider changes simultaneously, to keep the focused object the same size, creating a dolly zoom effect. Notice how, at the position of the focused object, the field of view has the same size, while at points closer and farther away, the field of view gets bigger and smaller.

This is actually closely related to parallax. That post shows what parallax looks like when you move left and right. This is what parallax looks like when you move forward and backward.