Luck plays more of a role than what most people will want to admit. Take anyone we view as being successful in America who is white (and there aren't many that aren't), and ponder at if they would have had such success had they been born a minority racial group.
Many people are also just in the right place at the right time, know the right people, or are just in a very fortunate position.
There is also the luck of being born into a wealthy family that can afford a better education, better education tools, and more prestigious colleges.
Some are lucky with what resources they have available to them, or not available to them. I'm lucky that I was able to stop claiming my parents on my FAFSA early, or I would just be starting my education rather than having two semesters and a few weeks left on my associates program.
Hard work also plays a role, but it rarely seems to be the true focus of a rags-to-riches story.