Bron hit the high points: Read the submission guidelines; network with other authors in your genre; hone your manuscript. And yes, sometimes it's just dumb luck.
I self-published my first two books, and threw myself into learning the art of self-promotion and marketing. Of course, the first book was before I found out about the e-publishing world. The second was when I was still trying to wrap my head around the idea of e-books. As a person who enjoyed hand selling her books, how do you market a virtual book, one you can't hold in your hand?
I've learned some valuable lessons in the past five years.
-If another author sends you the 'call out' email, don't take it on blind faith. Double-check the publisher's submission guidelines? I'm sure there was an editor who treated my rookie submissions (yes, there were two!) as a good laugh or at least a workshop on Not-What-To-Do. In fact, one of my stories was rejected TWICE. Either they left it in the slush pile for a good laugh before someone deleted my file or they were on the fence about that particular story and had someone else take a look at it.
-Even if a trusted author asks you to send your manuscript, then wants to sign you immediately to a publisher you've never heard of, do your homework. Talk to others who publish with that company, and NOT on the loop. Do it privately. And don't be so thrilled your 'baby' has finally found a home....take a step back and thoroughly check out the company. I found out a month too late I'd made a bad decision and am now trying to work up the courage to ask for my rights back. I have to be careful, because of barely-legal/ethical issues. And that's all I'm going to say. Want to know more? Email me privately.
-If you believe, heart and soul, that you've written the best work of your life, but your baby is still rejected, get a critique partner, preferably someone with an editing background, and ask them for an honest opinion. Then try to alter your MS in order to take their advice, yet stay true to your story. In my case, it was adding a single line of dialogue to a secondary character. Seriously, that's all it took.
-If you're still unsure about a publisher, read a few books pubbed by them. Do you like their covers? Are you finding editing mistakes? Is their website user-friendly?
-And finally, connect with other authors. Are they supportive? Cliquey? Friendly? Willing to offer advice if your stuck on a scene? Pull your name out of their hats during contests for free books? (LOL...Just kidding on that last point. Or am I?)
Of course, you can disregard everything I've said and simply take the plunge. After all, if you're a loyal reader of this blog, you'll notice the following publishers are represented: Total-E-Bound; Resplendence; Ellora's Cave, and Secret Cravings. See there? Your search as already been shortened to four. What are you waiting for?
We'll be here to help you celebrate your success or encourage you to keep trying:)