Tyres are the only contact point for your bike on the ground and getting your tyre pressure setting correct can transform your ride experience to a safer and more enjoyable one, not to mention more efficient. This can prevent punctures, give greater traction, absorb bumps better, rolls faster and generally increase safety.
No one likes getting punctures, and riding with low pressure can increase the risk of them. It can make the bike feel spongy and unwieldy, creating an unstable platform. It will also reduce the life of your tyres, wearing away faster. Low pressures can increase traction for mountain bikes, though with the risk of more punctures and creates greater rolling resistance.
Over-inflated tyres can make for a very harsh feeling bike. Because the tyres won't be able to conform to the road or trail, having too much air can reduce traction and grip. It can reduce rolling resistance, though, and so increase efficiency. This works on a smooth surfaces, but can cause a loss of efficiency on rougher surfaces.
Different tyres have different pressure requirements. Generally speaking, the smaller the tyre, the higher the pressure you will pump into it. So, a 23c road bike tyre will have a much greater pressure requirement than a mountain bike, usually 100psi versus 35psi, with hybrid and cyclocross bikes fitting in between the two at around 60-70psi. You can find the indicator of the minimum and maximum pressure that your tyre can take on the sides of the tyre. The pressure will be shown in both PSI and Bar. Often you should aim to set the pressure to the middle of these pressures.
There are two main types of valve that bicycles use. The Schrader valve is bigger and what you'll find on cars and motorcycles, which can be seen in the left image. The Presta valves are more often found on bicycles, and can be seen in the right image. Most pumps will be able to inflate both kinds of valves.
For Presta valves, firstly remove the dust cap. You will see a small tip which you must unscrew until it stops. The valve is now open. Connect the pump head to the valve and lock it off (usually by pulling the lever out from the pump head). You can start pumping now. Schrader valves also use a dust cap, which you remove. From here, you just need to attach the pump head to the valve and lock it off.
Now pump in the desired pressure into the tyre. You can see it moving by the gauge on the pump. Once you see the correct pressure indicated on the gauge, stop pumping. We usually start with a setting that's in the middle of the manufacturer's recommended pressures.
Now it's time to remove the pump. Unlock it by putting the locking lever back flush with the pump head. Now, pull the pump head off. Don't forget to screw the valve closed again for Presta valves. Replace the dust cap.
If you're a lighter rider, then it might be worth pumping in less pressure to get the comfort and traction. For heavier riders, more pressure is probably required to gain the support necessary from the tyres.
The best way to find the right tyre pressure for you is trial and error. Described above is a good way to get a base setting to work on. If when riding you feel like the ride is overly harsh and uncomfortable, then look at lowering your pressure. If, on the other hand, it feels unwieldy and unstable, more pressure is probably required. It's useful to record your initial pressure for future reference. Keep in mind that road bikes will have a harder ride than a mountain bike, and that the smaller the tyre, the harder the ride and vice versa.