In typography, there are actually two types of dashes: "M" dashes and "N" dashes. "M" dashes are longer, about the width of an "M" from the same typeface. They're used to set off asides in sentences like this:
I went to the store and -- yikes! -- got bit by a dog!
Or to attribute quotations:
"It's better to go to the store and get bit by a dog than to have never gone to the store at all."
-- William Shakespeare
(Obviously, I've substituted two hyphens for the actual "M" dash in these examples, because I don't think ASCII has "M" dashes.)

"N" dashes are used less frequently, usually to indicate an interval between times or dates:
Due to a dog bite, the store will be closed June-July.
Neither type of dash should be confused with a hyphen, which should only be used to hyphenate words.

On a Macintosh, you can get an M dash by hitting option-shift-hyphen and an N dash with option-hyphen. Or, if you're like most people, you can just ignore everything I've just said and do it the wrong way.