You've heard it before: Choose the right tool for the job. If you have only one hammer, you probably need more. Here's a quick overview of several types of hammers and how they're used.
A claw hammer is the first hammer that comes to mind when you hear the word. One side of the head is used for driving nails; the other side is a curved V. You can wedge the head of a nail into this V and pry the nail out of wood.
Framing hammers are slightly larger and heavier than a claw hammer. The face of the head (the part that meets the nail) is rough so that it's less likely to slip off a nail. The extra weight and size makes driving larger nails (used for building walls and roofs) more efficient.
For smaller nails like those used for attaching trim or joining corners of picture frames, you can use finish hammer. These are smaller, lighter versions of claw hammers.
Ball-peen hammers are generally used for mechanical and metal projects. Instead of a 'claw,' one end of the head is rounded like a ball. You might use a ball-peen hammer for removing (or creating) dents from metal, tapping bearings onto an axle, or pounding a metal punch.
For heavy-duty work, sledge hammers are the best choice. Smaller sledge hammers (3 or 4 pounds) might have a shorter handle so you can manage them with one hand. These hammers are appropriate for driving small stakes, some metal work, etc. Heavier sledge hammers (16 pounds or so), have longer handles so you can get a more powerful swing and be more accurate in your aim. These hammers are great for demolition, pounding posts, and ringing bells at county fairs.
Many times, you'll want a softer touch. In these instances, use a rubber mallet. These are great for tapping hub caps into place without denting them. You can also use them on wood when making joints.
There are other less common types of hammers, too. If I've overlooked your favorite, you can tell us about it in the comments section below.