Awhile is an adverb that will most commonly follow a verb. (Could you wait awhile?)
A while is a noun form and usually appears after a preposition (usually for or in). The main confusion here is that both can be used in very similar sentences:
Sit awhile (adverb) and Sit for a while (noun) are both correct.
The key is to look for the preposition. If you see one of those little words, you should use a while.
Note also that while is a subordinating conjunction, which starts dependent clauses.
Example: While she waited for the bus, the lady rested for a while on the bench. The bus came awhile later.