I read the other day the remarkable story of how "Lord of the Flies," William Golding's first novel, came to be published. Let's look at this in terms of "there's good news and there's bad news."
Bad news: It had been rejected 20 times before it landed at Faber and Faber. They rejected it, too.
Good news: One of the editors needed something to read on the train on his journey home and grabbed the manuscript off the 'reject' pile. When he read it he saw potential. He worked with the author, and the book was published in 1954.
Bad news: The hardcover got mixed reviews and was only modestly successful in terms of sales (less than 3000 in the U.S. before it went out of print).
Good news: The paperback edition came out and sales picked up, especially among young people.
More good news: Teachers started assigning the book and it became a best seller.
More good news: A movie version was made (twice) and there are stage productions as well. The book is now considered a modern classic and continues to sell well.
More good news: In 1983 Golding received the Nobel Prize for Literature. In 1988 he was knighted.
Do you notice a pattern? At the start it's bad news--quite a lot of it--punctuated with some good news. As the process moves on, it's a lot of good news, punctuated with much less bad.
That's the secret of how to get lucky. Hang in there through the bad news, which may well predominate at first. Keep going. Golding didn't stop after 10 or 15 or 20 rejections. He kept submitting his manuscript. By the way, he was 43 at the time, so he also didn't give in to any thoughts that this might be too late to start a career as a novelist. He also listened to the useful input from his editors and rewrote the manuscript.Despite the unpromising sales at first, he continued to write other novels, including "The Inheritors," "Pincher Martin," and "Free Fall."
To adapt another useful bit of advice, "When you're going through bad luck...keep going."
(It also helps to have good advice, of course, and you'll find a lot of that in my book, "Your Writing Coach," published by Nicholas Brealey and available from Amazon and other online and offline book sellers.)