A while is a noun phrase in which "a" is an article, and "while" functions as a noun meaning "a short period of time."
Awhile is an adverb meaning "for a while."
The word awhile has "for" built into its meaning.
Basically, the meaning is the same, it's the structure that differs.
A mnemonic to assist in determining which to use, is whether "for a while" could be used in the sentence, without changing its meaning, where you were intending to use awhile.
********************************************************************************************************************
Examples:
- "I'll speak with you awhile" is correct because you could also say, "I'll speak with you for a while."
- "I'll speak with you for awhile" is not correct because you're actually using the word "for" twice.
(awhile = for a while: "I'll speak with you for for a while.")
- "I'll prepare my blog in awhile" is not correct as you would not say "I'll prepare my blog in for a while."
- "Writing the blog may take awhile" is not correct because, "Writing the blog may take for a while" is not idiomatic English.
(awhile = for a while: "Writing the blog may take for for a while.")
- "I have relatives staying with me awhile" is correct, as you could also say "I have relatives staying with me for a while."
- "I have relatives staying with me for awhile" is not correct, as in actuality that would be saying, "I have relatives staying with me for for a while."
********************************************************************************************************************
The two-word noun phrase a while is more often the correct choice that is the one-word adverb awhile.
Most grammatical errors involve using awhile where a while would be the appropriate choice.
Again, remember the mnemonic of placing the word "for" before either choice. It's a nearly foolproof way of determining which is appropriate to use.
Sources: Gregg Reference Manual, Grammarmudge, AP Stylebook, CMS