Gear ratios play a few different roles in a vehicle. The main one is to keep the engine somewhere that's at least vaguely near its most efficient rev range.
The way that drivetrain gearing works is much the same, mathematically speaking, as a set of pulleys. That is, in the same way that a pulley system allows you lift or move something heavy by spreading that load over a greater distance, the gearing in a car's drivetrain allows it to spread the work over a greater rotational distance (meaning that it will rev faster), thus multiplying the torque.
As you are probably aware, combustion engines have a minimum rotational speed they can achieve without stalling. They also have a maximum speed they ran reach before things start to fail and break. Between those two extremes they have an ideal operating range, which you can see plotted on that vehicle's power and torque curves (which may or may not look linear).
In almost all drivetrains, there will be gears in the gearbox (if it's a manual) or the transmission (if it's an auto) that can be selected as you drive (or selected for you by an auto), as well as a final drive ratio in the differential further multiplying the torque output (by reducing the rotational speed from the input shaft to the output shafts).
Even electric engines operate more efficiently when there's more than one ratio in the transmission (or gearbox) to work with, but combustion engines really need the right gear to be selected, especially those with a narrow torque band, such as a diesel or any engine with a very small capacity.
The other thing that gear choice does, after helping you get up to the designated speed, is cruise without revving the engine too much or too little, reducing the strain on components and using less fuel (or energy).
More ratios can be helpful in some vehicles too, if the torque band is particularly narrow (like a haulage truck), or changing gear doesn't take much time (like a paddle-shift race car or the sequential shift of a motorbike).
When building or modifying a vehicle (and where the category rules permit), altering the ratios (for the individual gears and the final ratio) can also eke out slightly better acceleration, be it from a standing start, or coming out of particular corners.
This effect is also more pronounced the more directly the engine is coupled with the wheels, by which I mean fluid couplings (automatics) dull it. That said, most modern automatics do have locking mechanisms in the torque converters which also keep the engine more firmly bound to the wheels (whenever a gear change isn't needed).
In particular, that matters most for when we lift off the throttle in a corner. Depending on the vehicle in question, lifting off will achieve anything from as mild as just helping the nose tuck in a tad tighter, to tail-swinging lift-off oversteer, and the gearing is yet another thing which influences how dramatic that effect is. The shorter the gearing, the more quickly the engine will be able to decelerate the vehicle, increasing this effect.
When it comes to choosing which particular gear to be in when cornering, this effect is even more pronounced. Dropping down one more gear can help use that lift-off effect to tuck the nose in even more, or it will just make you more likely to overdo it and get way more lift-off oversteer than you meant to.
The more gears you have to choose from, and the easier it is to change them (current F1 cars have eight gears, and change in milliseconds with the tap of a paddle on the wheel), the more likely it is you will just pop it down one more gear for the sharpest part of the turn then pop it straight back up to control the acceleration. And that's another way you can use gearing choice to your advantage. If you don't have traction control (or even if you do, you'll be quicker with a lower setting than a higher one), and you're anticipating the power overcoming the tyres on corner exit, you can grab the next gear a bit early (a common practice called short-shifting) to control the delivery of torque to the tyres.