When to Use an En Dash
The en dash is generally used to indicate ranges of nearly anything, such as numbers, pages, dates, and game scores.
Right: Our team won the game 24–10. (en dash, because it's a game score)
Wrong: Our team won the game 24-10. (hyphen is wrong)
The contest runs July 7–21.
You can find the recipe on pages 74–76 of the cookbook.
The en dash is also used when phrases are hyphenated more than once (compounds of compounds). It's used so that the phrase looks better than if it had two hyphens, and helps make the compound phrase easier to read.
Example: Firefox is an open-source–based browser. (Notice that "based," the second word modified, is preceded by an en dash.)
Space is normally not added on either side of an en dash. Some typographers add hair spacing or track out spacing just a bit on either side (never to a full space width), but this is personal preference based on looks.