In a typical configuration like what you have, let’s assume you start out with no current going into the base. This is what is called cutoff, and there will be no current from the collector to emitter. As you start increasing the current going into the base, you’ll start to get current flowing from the collector to the emitter. This gets you into what is called the forward active region of the transistor. For a while, as long as you increase the current going into the base, you’ll get a corresponding increase in the current flowing between the collector and emitter, multiplied by a factor which is called the gain of the transistor (also called the beta). Eventually, you reach a point where the transistor saturates, and no matter how much you increase the current going into the base you don’t get any more increase in current from the collector to emitter.
If you want to operate the transistor as a switch, you want to keep it all the way in the cutoff region when it is off, and you want to drive it all the way to saturation when it is on.
If you want to operate the transistor as an amplifier, you want the exact opposite. You want to avoid saturation and cutoff, and keep the transistor operating in its forward active region. What you want to do is put a bias current into the base (which can be set up with a couple of resistors) so that when there is no signal, the transistor is right smack in the middle of its forward active region (called the transistor’s Q point, or quiescent point). Then, if you add positive current to the base, the output of the transistor will increase proportionally, and if you add negative current into the base, the output of the transistor will decrease proportionally. If you look at the voltage output of your circuit, at the Q point, the output would be half way between Vcc and Gnd, and as you vary the current going into the base, the output will swing up and down around this point.
Most microcontroller outputs can’t drive a relay directly, because they can’t provide enough current for the coil. You’ll usually have a transistor, similar to your circuit, driving the relay coil. The important thing about relays is that when the relay switches off, all of the energy that was stored in the coil has to go somewhere. If you don’t give it someplace to go, it will likely feed back into your microcontroller and make it go poof. Fortunately, the simple solution for this is to stick a reverse biased diode across the relay coil. When the relay is on, since the diode is in the reverse direction, it doesn’t do anything. When the relay turns off, all of the energy in the coil discharges through the diode, instead of frying your circuit.
By the way, if you are going to do some reading, I would suggest “The Art of Electronics” by Horowitz and Hill. If you are going to tinker around with electronics, it’s well worth the investment of buying your own copy. It covers a wide variety of topics, and is well written such that a relative newbie can still understand most of it, though in places it does get a bit above the head of your average novice. It also has examples, and even shows examples of common misconceptions and mistakes that people make.