>>1045191The goal when choosing gears is to make it so that you can pedal easily, without straining your legs or having to stand up on the pedals all the time, but not geared so low that you'd have to turn the cranks impossibly quickly to make the bike go faster. The gear you should use will vary according to the terrain you're riding on - high gears for going downhill fast, low gears for going up a steep hill or over rough/loose sections offroad.
The gears on the front (3 in your case) provide relatively large jumps in the ratios between the gears, while the difference between all of the seven gears on the back is much smaller. You'll use front gears to shift to a smaller chainring before starting a big climb, use the rear gears to make fine adjustments when the hill you're climbing gets just a little bit steeper/shallower.
There's not really any specific rules about how you have to shift, because it depends so much on where you're riding (and how strong you are). Learning exactly what gear to be in and when to shift are things that you'll learn with practice. The only technical thing you should be aware of that's more specific than 'do what feels right' is that you should avoid cross-chaining. See pic, it's when you're in the big-big or small-small combinations, you want to avoid this because it takes in those combinations the chain is having to bend/twist a lot, adding friction inside that drivetrain that you have to fight.