A non-compete is the seller's promise, signed as part of the sale, not to compete with the business after leaving it, limited in time, geography, and activity.
In a sale
The agreement's terms and the state's law: the letter of intent and the purchase agreement set how long it lasts, where it applies, and what it covers, and the state decides how firmly a non-compete tied to the sale of a business can be enforced. A founder-friendly version is limited to the business as it is actually run. How far one reaches in your state is a question for your attorney.
Where it comes up
The Go-To-Market Analysis (GTMA) builds the file a buyer would build on your business, before a buyer does.