In general, we use hyphens to avoid ambiguity. Otherwise, how would we be able to tell the difference between a “man-eating shark” and a “man eating shark”?
A definitive collection of hyphenation rules does not exist; rather, different style manuals prescribe different usage guidelines. In the style guide that I use most frequently—American Medical Association Manual of Style—there are eight pages on the hyphen. These pages include rules for when to use hyphens and when not to use them.
Hyphenation rules can be exceedingly complicated. Byzantine even. (I want to write, not solve differential equations.) I once spent 30 minutes explaining to someone why “work up” is hyphenated in some instances, but not others.
Hyphens connect words, prefixes, and suffixes permanently or temporarily. When not otherwise specified, hyphens should be used only to avoid ambiguity. What follows is an abridged version of the hyphenation rules taken from the AMA Manual of Style. Other style guides will have different rules, but this is a place to start.
Hyphenate when the terms are used as an adjective before the noun.