Photographic skill improves through practice. No matter how good you get though, not everything is predictable when you're shooting in the outdoors. Sometimes your luck is good. Sometimes it isn't.
The weather is perhaps the most unpredictable element. Everyone knows that, at least here in the rainy Northwest. A quick check of the forecast will confirm that nobody really knows when it's going to rain. Sometimes a shift in the weather can leave you without a beautiful sunrise. Other times it can grant you the gift of dramatic skies elevating even ordinary subjects into once in a lifetime masterpieces. Decide to sleep in on an overcast morning and you may miss a gorgeous sunrise as those clouds clear at just the right time. Steel yourself to get out of bed in spite of the potential for bad weather and you may end up getting rained out. You just never know until whatever happens, happens.
Subject matter can be equally beyond your direct control, even when you plan to be in the right place at the right time. Mountain wildflowers bloom in their own sweet time, but it tends to be around the same time each year for any given location. But if it's been a bit warmer one year or a bit drier, or a bit something else, they may bloom earlier or later than you anticipate. Get their too early and you'll barely find small plant shoots poking up through the tail end of the melting snows. Too late and they will already be past their prime and starting to wilt, or worse. Some of the most photogenic flowers have the shortest of seasons. Your luck with them will likely vary.
That's the thing about luck, it manifests itself in both good and bad varieties, and sometimes you don't know which you will encounter until you're confronted with it directly in the moment.
Equipment problems tend to fall into the category of bad luck. I hiked up from the Paradise visitor center on Mt. Rainier to be there at first light one morning only to discover that the focusing screen had worked its way loose inside my camera body leaving me with no way to focus let alone shoot without an unsightly obstruction obscuring the middle of every frame. On the side of the trail, I poked at it a bit by hand but soon realized I would only make matters worse if I persisted. I was forced to hike back down to where I had parked without shooting the sunrise at all. Only then did I have the proper tools to reseat the focusing screen and clean the sensor after my mountainside fumbling earlier. Lest I leave you with the impression that the morning was a loss though, I was treated to cooperative fox stretching and sunning himself on a rock wall right next to my car after I finished my camera repairs. Had I been a couple miles up the mountain, I would have missed photographing that fox. Rarely does one encounter a fox up close and personal. The luck of the draw is hard to predict indeed.
People generally get upset or even mad if they experience bad luck. If they have good luck, they are happy. Yet their luck is generally not something attributable to anything they directly did. That's why it's called "luck" rather than "skill." Luck is what happens to you despite what you plan for.
Sometimes I find that photographers tend to blame bad luck when things don't turn out well, but are all too ready to take the credit themselves when things go well even when the results weren't entirely of their own making. It's easy to blame your luck to avoid taking responsibility for your mistakes. But doing so does you no favors. You can't learn from your mistakes if you deny making them.
If you find yourself in a lucky situation but aren't prepared to take advantage of it, is it luck after all? Maybe it just became bad luck instead of good. It all depends on how you look at it. Which would do you more good in the long run: blaming your bad luck that the mountain goats stayed too far away for you to get a good shot, or learning that next time you need to bring a longer telephoto lens? You can't be prepared for everything, but you can and should be prepared for what you have found out can indeed happen, and likely will again.
Sometimes you end up with a great shot of one thing while trying for a good shot of something else. An unfortunate sun flare ends up creating a dramatic leading line for your composition. A lack of critical focus creates a moody shot with only the nearest edge of your subject in remaining in sharp focus. You goofed, but the results turned out great in spite of your efforts. This sort of luck does indeed happen, although more often than not that sun flare will ruin an otherwise good shot and that focus problem will leave you with nothing better than a reject. This is the sort of luck to be thankful for when it saves you but something hard to strive for.
I've had my share of luck both good and bad over the years. You likely have as well if you've been at this very long at all. Recognizing it when it happens can help you take best advantage of it, but as a general rule you are better off honing your skill at getting good shots under whatever circumstances you find yourself. Consider good luck as just that when it happens, and rely on your skill and experience to help you make the best of bad when it comes your way.
Others may just think you lucky, but the better you are applying your photographic craft the better your results will be in any circumstance.