What do you already know about gears? Are you ok with the general principles -
Chain ring (front gears) small ring for lower speeds, big ring for faster.
Cassette (rear gears) bigger sprockets for slower speeds, smaller ones for faster.
Aim to keep your cadence (number of revolutions of the pedals per minute at at least 80), so change up and down to a gear that allows this.
You should change down several gears at a time if you are slowing, to enable you to pedal off comfortably, but only change up sequentially, unless you are going down hill.
Avoid having your chain at too great an angle- on your 8 speed cassette, when you are in the small chain ring you should use gears 1-6 (1 being the biggest sprocket) and in the big ring, gears 3-8.
If you are more or less doing this and your gears are not indexing (moving) cleanly from one to the next, or if the gears are slipping as you are riding along, or if they are clicking no matter what gear you are in, then you need to take your bike to your local bike shop and ask for a gear service, as they are malfunctioning.