Here are some factors that may come into play in determining if your book will be published.
You have written a book for an established market, and you have written with a unique slant. This will give your book an edge because there is a proven market. Think of cookbooks. Often, people who buy them buy many different ones. (I know this from vast personal experience.)
You have anticipated a market no one else has thought of. There is a market ready to buy and no competition. It's all about supply and demand. If you are the only book on a topic of current interest, you have a clear field. Just be ready to sell, sell, sell that idea to a publisher.
You have a non-fiction book with excellent content. That might mean an up-date on trends or information, or deeper research than others have provided, or some amazing or startling discovery. You come across as a real expert.
Or you are the recognized expert already and your name alone will sell your book.
You have a piece of fiction or poetry that touches deep human needs with elegance and power.
Beware! Fiction and poetry are harder to sell in general. You must really stand out in this market to make significant sales.
Finally, how well written is your book? If your book fits into any of the categories above, AND it is accurately and powerfully written it has a good chance of being published. That is not a guarantee, just a good probability.
If you self-publish, your edited book will ensure that you look like a pro.
That means more sales and spin-off opportunities, like speaking engagements. On the other hand, unless you have written content of such undeniable value that a publisher or reader is desperate to get it, a poorly written text will not see the light of day.
A word to those submitting manuscripts to agents or publishers...
If you submit substandard work and are rejected, you absolutely do not get a second chance. Do not send off your work until you have made it as good as it can be.
This site has a great deal of information to help write something that might get published. Check them out from the home page.