Sometimes selling your business can make sense in theory, but the process can fall apart if all the pieces aren't in place ahead of time. Take for example the situation at Hewlett-Packard. In 2011, the tech giant acquired U.K.-based enterprise software company Autonomy Corporation for $11 billion. But just last month, HP said it was "writing down" Autonomy's market value by $8.8 billion, attributing as much as $5 billion to "accounting improprieties, misrepresentations and disclosure failures [intended] to inflate the underlying financial metrics of the company."

Autonomy co-founder Mike Lynch has since launched a website called AutonomyAccounts.org to "utterly reject" all allegations of impropriety. "It's clear that the buyer wound up with something not quite what it thought it was buying," says Kip Witter, a vice president at The Brenner Group, Inc., a Cupertino, Calif.- based financial management and advisory firm that works with Silicon Valley tech companies.

While transactions of this magnitude and with this kind of fall-out might not be common, entrepreneurs who want to sell their business should have several factors worked out ahead of time.

A buyer is expected to do "due diligence," meaning it will conduct a confidential, in-depth look at your business and try to get a read on your management team. "A bad showing in due diligence can kill the deal entirely or reduce the price, so for the selling company, this is a vital test," Witter says.

Here are three things entrepreneurs should keep in mind when preparing a business to be sold:

1. Expect your dirty laundry to be exposed.
From contracts to litigation to human resource issues to patents to competition, a business owner should expect the buyer to dig up these issues during the due diligence process. Witter says a due diligence checklist can guide you to what you need to provide and how it should be organized. "You know who your competition is, so tell the buyer," Witter says. "Identify any soft spots, such as not having a senior sales executive," for instance.

2. Work with an experienced expert.
Witter recommends taking closer a look at your accountants and attorneys. Have they handled acquisition transactions like this before? It's important to know since there are major tax, legal, human resources and operating issues involved in selling your business.

"If the transaction is large enough, the seller might consider an investment banker to advise him," Witter says. "The seller will want someone in his corner who has done this before, who can gauge the fairness or reasonableness of what is being offered."

3. Have a human resource plan.
The sale process can be distracting and even disruptive to your staff. Before embarking on a sale, decide how and when to loop them in on it. While you might do some of the preliminary, exploratory work on the down-low, your employees will eventually want to know what will happen to them. But informing them too early in the process can be a bad thing, Witter says, since distracted employees can cause your business to suffer.