I'm not going to get into much detail regarding fit here, this is something your local bike shop should assist you with when you purchase the bike. If they don't help you find the right fit and are more interested in just selling you any bike, find another shop. An incorrectly sized bike will cause you nothing but pain.
Lets start with the basics (assuming you have a properly sized bike). Always keep in mind that as you make one change, it can and will affect other things, so everything needs to be approached as a whole.
Your seat should be set high enough that at the bottom of the pedal stroke, your knee has a very slight bend. You should be able to lock your knee if you push your heel down.
|Notice the slight bend to the knee. If the rider pushes his heel down, his knee will lock.|
To adjust the forward/backward position of your seat on the rails you will want to sit on the bike normally and try removing your hands from the bar without sitting up. If you find your back is supporting the weight, you should move it back a bit. The goal is to have it just far enough back that it helps take some of the weight off your arms. The bar is there for steering, not to hold you up. There is a catch with this one, if you push the seat forward, closer to in line with the bottom bracket, you will give your self the ability to pedal more powerfully at the expense of comfort. The trick is fining a balance between the two.
This one will be different for men and women. For men, the seat tends to be tilted back more than womens seats. What you are going for here is comfort. Start with the seat roughly level and then sit on the bike in your normal riding position. If you find you are falling forward and putting a lot of pressure on the handle bars, then tilt it up a bit. If you find that the nose of the seat is causing too much pressure in sensitive areas and is not comfortable, bring it down a bit. Again, the goal is to find the happy medium in between the two.
This one is not as easy to adjust as the seat height/position/tilt as it generally requires replacing of the stem to make adjustments. The lower and further forward you end up with you will get more power and aerodynamics again at the cost of comfort. You will want to find a rise that matches the style of riding you do. For touring, you will be best suited with something roughly level with the seat. For a mountain or road bike, a few inches below the seat is more suitable. The important thing here is to find something that feels natural to you.
The position of brakes and shifters on your bars are also important. However these are affected greatly by your riding position. As such, you should save this step for last. Since these vary so greatly from flat bars to drop bars I'll cover them separately.
Sit on the bike in a natural riding position. Now lift your fingers as if you were to put on the brakes but do not rotate your wrist. (In most cases you will find they are pointing somewhat downwards, it is a pet peeve of mine when I see bikes with them set flat). Once you have an idea of where a natural location for your fingers to be without rotating your wrist, set the brakes at that angle. Take the bike for a quick ride and see if you find you are having trouble getting your fingers up from under then on to the levers, or if you have to reach up to catch them. If so adjust accordingly until the brake leavers are naturally where your fingers want to go.
Since the brake hoods will double as a place to rest your hands you will want to place them in a position where it is comfortable for your hands to sit on the top. Once this is done, put your hands in the drops and check that the brakes and shifters are still easy to operate, if not you might have to sacrifice some of the comfort while riding on the hoods in order to maintain usability.