The thing that is confusing me is that the pin appears to be connected to both the ground and the +5V at all times. When the photoresistor is at 0 resistance, I know that the pin will read a low value and when the photoresistor is at full resistance the pin will read a high value, but I don't understand why when the pin is also always connected to the +5V through the 10k resistor.

I'm sure this is basic, but can someone please explain how to calculate what the pin will measure in the different scenarios? I really appreciate your help!

I will take a SWAG and say R1 is a temperature sensor. Assuming it is 10K at 25C. A0 will have 2.5V applied. Now assume it goes to zero and R1 is 1K then A0 will be about 0.45 Volts. Once you know the two endpoints of the sensor you can use the map() function to calculate temperature. If R1 happens to be another resistance sensor the solution is the same, the numbers will change.

In your schematic R1 and R2 form a simple voltage divider. Much as has been pointed out. We know R2 value is 10K ohms and let's assume R2 is perfect 10K ohms. The Vout or in your drawi9ng A0 pin will be a function of the value of R1. So if R1 is zero ohms Vout will be 0 Volts. If R1 is open or infinity then Vout is 5.0 volts. If R1 is 10K and R2 is 10K then Vout is 2.5 volts based on your drawing and 5.0 volts applied.

What happens is we remove R2? Well if R1 were 0 Ohms we have a short to ground.

R1 can be any variable type resistor. Thermistor, LDR and a host of other sensors using a changing resistance.

Thank you all. Voltage Divider was indeed the term I was missing.

I have a follow up question for deeper understanding - The internet has plenty of info on the voltage divider maths and I can now use that to understand the initial circuit, and understand how that is derived from Ohms Law. My question is, what actually happens at a physics level to cause this effect? Can we explain it in terms of what the electrons actually do in the circuit? I've tried Googling for this but every site seems to just explain it with the Ohms Law maths. I'm keen to gain a visual understanding as well as the maths.

Electrons passing through any material lose energy (measured as voltage), producing heat.

Ohm's Law is is an approximation that reduces that energy loss to a linear relationship between voltage and current. It works very well for most, but not all conductive materials.

Sometimes it's a matter of knowing what to Google. "electron flow theory" is a good start. Really while taught in electrical engineering (I think it still is) I can share with you that it really matters not if current flows one way or the other way. Nothing I came across in over a 45 year career. The math functions all work the same.