A very basic answer is when the front gear is very small and the back gear is very big it will take (this is just an example) 5 pedal turns to turn the front to make the back spin once, resulting in more torque/pushing power like what you need going up hill.
Reverse that and you will have more speed because the front is spinning once and the back is spinning 5 times but you sacrifice the torque/pushing power, this is what you would use on a flat surface.
Latest Answers