That is an awful broad question, but I'll take a stab at it ..........
Regardless of what gearing combination, the rule of thumb is cadence ........ this is the rpm of your pedaling. The key area to be in is in the 90-100 rpm's.
If you are starting out, the main thing to work on is getting a smooth pedaling stroke, and keeping your cadence up. A high cadence allows you to work a little less "harder" than when you are trying to grind out a bigger gear.
This applies to flat-land riding mainly. Climbing has a different tactic, but still uses the same principles. For climbing, try to stay in the same range if possible, but more people end up in the 75-85 rpm range. This will be while in the saddle.
When you are tiring out, and the gears start disappearing (and you're down your 39-23 ............), it is fine to stand up to climb. When you stand, move forward on the bike so that you are driving down on the pedals. But it is VERY important that when you stand, you shift down to a harder gear (i.e., go down to a 39-21 if you are in the 23 sitting). Stay smooth, don't get jerky. Any wasted motion is wasted energy, and will just make you bonk faster. Then when you sit down again, shift back to the easier gear, and keep the cadence up.
Gearing is very personal choice. When I was racing, I ran a 42/53 in the front and an 11-21 in the back. The 42-21 was fine for me, even for brutal climbs. But that was many years, and many pounds ago ...... :p ......... now I run a 39-21.
Cadence, ryhthm and fluidness are the key to getting lots of miles in, and improve your skills.