There are various types of notes, each of which is held for a different length of time. The way a note appears indicates how many beats it should last.
In most music:
Whole notes last four beats.
Half notes last two beats.
Quarter notes last one beat.
Any note shorter than a quarter note has one or more "hooks" to indicate its length. Each hook cuts the note's length in half.
Eighth notes (one hook) last one-half beat.
Sixteenth notes (two hooks) last one-quarter beat.
These continue on to thirty-second and sixty-fourth notes (with three and four hooks, respectively). If two or more notes requiring hooks appear in a row, they're often connected with "beams." The number of horizontal lines in a beam indicates note length.
Two eighth notes connected by a beam
Music also has rests, which indicate silent beats. They're counted in the same way as notes, and correspond to the notes they represent.