Focusing LED using a Fresnel lens at different distances Simple setup:
A Red LED in front of a small fresnel loupe/lens (credit card size). Using a screw I can adjust the distance between the LED and the lens. The LED is centered with regard to the lens.
My question:
I pointed my assembly at a wall 1 meter away and adjusted the distance so that the resulting spot on the wall has the smallest diameter (increasing and decreasing the distance at this point results in the spot to grow and get blurry). Then I aimed at a different wall which is about 4 meters away and the spot got bigger - as expected. However, I was surprised to find that, with the different distance to the wall, adjusting the distance between LED and lens leads to a more focused spot.
What is the reason for this? Why and how does the distance between LED/lens and the wall I am pointing at matter?
A picture for the 3 cases: 1m (diameter 3cm, focus), then turned at 4m (12cm, out of focus), then distance adjusted (10cm, again focus)

 A: A picture of a simulation that helped me to better understand what @DanielGriscom could have meant by "simple optics" in the comments.
I used https://ricktu288.github.io/ray-optics/simulator/ to simulate a point source and a moving lense. One can clearly see how the point where the rays get focused moves when the distance changes. The distance between LED and lense has to be adjusted according to the distance between wall and lense. The properties of the lense are the determining factor for how the system behaves.
You can save the following with your favourite editor as a .json file. Then you can open it with the simulator, select the different parts, and rearrange them.
{"version":2,"objs":[{"type":"radiant","x":214,"y":520,"p":0.18},{"type":"lens","p1":{"type":1,"x":360,"y":460,"exist":true},"p2":{"type":1,"x":360,"y":580,"exist":true},"p":125},{"type":"ruler","p1":{"type":1,"x":360,"y":580,"exist":true},"p2":{"type":1,"x":2280,"y":580,"exist":true}},{"type":"ruler","p1":{"type":1,"x":360,"y":580,"exist":true},"p2":{"type":1,"x":20,"y":580,"exist":true}}],"mode":"light","rayDensity_light":0.3423916574278969,"rayDensity_images":1,"observer":{"type":5,"c":{"type":1,"x":240,"y":663,"exist":true},"r":20,"exist":true},"origin":{"x":0,"y":0}}


