Ecly:
I am quite new to Arduino and I wanted to try to make a night light using a photoresistor, and while I understand the coding part of it perfectly I had to look up how to set up the circuit and this one confused me, specifically how the photoresistor itself is wired. I set it up exactly like it did in the diagram and it works just as it should, but I don't understand why it works. I was under the impression that electricity wants to get to ground as soon as it can, so why would the A0 pin be connected passed the ground connection? So the 5v runs through the photoresistor which then resists the current depending on how much light there is, but then instead of it being set up so that the current flows to the A0 pin and then ground, they have it so that it flows to ground first then the A0 pin. Why would the electricity bother going to the A0 pin if it could just go straight to ground?
Your understanding of how electricity works is totally wrong.
Virtually no current passes to or from the A0 pin - it is a high-impedance input. It's just measuring the voltage on the pin.
The two resistors in series (the fixed resistor and the light-dependent one) form a voltage divider; the current through the entire resistor could be calculated by applying ohm's law to the total resistance. Then, applying ohm's law to one of the two resistors - using that calculated current - gives you the voltage at the mid-point. This voltage will depend on the resistance of the LDR. So by measuring that voltage, you can figure out what the resistance of the LDR must be, and hence how light/dark it is.
The pin is not connected straight to ground, it's connected through a resistor, which as the name implies "resists" the flow of current.
IMO, you need to review the basics. There are lots of guides around the internet that offer information at varying levels that will help you get a better understanding of how electricity works.