There are at least three methods for accomplishing this. Each is worth familiarizing yourself with.
The Cylinder Method
1. Create a cylinder
Add > Mesh > Cylinder
Adjust the proportions and vertex count to your liking.
2. In Edit Mode Select Edge Rings
Set your selection mode to Edge Select.
Select an edge, then while pressing CtrlAlt select the edge next to it. Alternatively you can use the menu: Select > Edge Rings.
3. Bevel the edge rings
Use cursor distance to adjust bevel width, then left click to accept.
4. Extrude the faces
Set your Pivot Point to "Individual Origins".
Press E to Extrude to your desired length.
5. Scale as needed
While still using "Individual Origins" as the Pivot Point, press S then ShiftZ to Scale the angle of the teeth. Scale the height using S, Z.
The Add-On Method
1. Enable the Extra Objects Mesh add-on.
There are two add-ons for Extra Objects, one for curves and one for meshes. The one that applies in this case is the one for meshes. Go to Blender's Preferences, search "extra", and click the check box to enable it.
2. Add a Gear
Press ShiftA and find a new option in your Add > Mesh menu: "Gears". Add one.
3. Tweak the gear parameters
The add-on provides many parameters for fine-tuning the shape of your gear. Play with it!
The Circular Array Method
1. Add a plane and model it into the shape of a gear tooth
ShiftA Add > Mesh > Plane
The plane is just a starter shape.
Model the shape of a single gear tooth in Edit Mode.
Make sure the Object's Origin Point is where you want the center of your gear to be.
2. Add and rotate an Empty
ShiftA Add > Empty > Plain Axes
From Object Mode, press R and type in 15 to rotate it 15 degrees. We can change this value later, it's just an example.
3. Add an Array Modifier to your gear tooth object
Uncheck "Relative Offset". Instead, check "Object Offset" and point it to your Empty.
Since we rotated the tooth 15° in this example, set the Count to 24 to start. The dimensions of your gear tooth object also come into play here, so you'll need to do some adjusting of these three factors: tooth count, rotation angle, and tooth geometry.
Check "Merge" and "First Last" so that you won't need to remove doubles later. This option merges the doubled-up vertices for you.
4. Close the loop
Set your snapping method to Vertex Snapping.
On the modifier, adjust the edit cage to the modifier result so the array geometry can be snapped to. In simple English: click the fourth button.
You can now extrude another vertex and snap it to the next tooth in the array. Fill in a face between this and the vertex in the center of the gear. The circle is now complete.
Here is a screen shot to further illustrate how one segment is used to create the entire gear:
5. Add some thickness
Finally, add a Solidify Modifier and give your gear some Thickness.