Marcus Aurelius was a Roman Emperor and the author of Meditations, considered by many to be one of the greatest works of philosophy ever written. Among his many ruminations, Aurelius has an interesting take on the concept of "bad luck" that remains useful to this day. In short, you should treat unexpected misfortune as an opportunity to reflect on your hidden strengths.
Be like the rocky headland on which the waves constantly break. It stands firm, and round it the seething waters are laid to rest.
'It is my bad luck that this has happened to me.' No, you should rather say: 'It is my good luck that, although this has happened to me, I can bear it without pain, neither crushed by the present nor fearful of the future.' Because such a thing could have happened to any man, but not every man could have borne it without pain. So why see more misfortune in the event than good fortune in your ability to bear it? ...So in all future events which might induce sadness remember to call on this principle: 'this is no misfortune, but to bear it true to yourself is good fortune.' - Meditations 4.49
What It Means
Scholars suggest the "rocky headland" is actually referring to a passage in Homer's Iliad, which describes the Achaean's ships fending off Hector's attack. But that doesn't change the basic meaning which is about standing strong against opposing forces -- like seemingly random adversity.
Aurelius suggests you rethink the moments you feel you've encountered "bad luck." Instead of complaining and lamenting your misfortune, show gratitude that you could withstand such an event. For you are, in fact, lucky. Others might not have been able to overcome, after all...
What to Take From It
When something unlucky happens to you -- be it something small like dropping and breaking your phone, or something bigger like getting into a car accident -- stay mentally strong and withstand its attack on your character. Choose to search for the silver lining, and feel blessed that you even have the ability to do so. Then, when you find it, shimmering among the sorrows, latch onto it. Make your glass "half full," so to speak.
Now, I realise that "always look on the bright side" isn't very useful on its own, but it can be if you apply it the right way. If you can find a way to let go of the anger, sadness, and other emotions that cloud your mind when bad luck strikes, you can stop, reflect, and see the inverse -- see how lucky you truly are. You're unlucky to have dropped your phone, yes, but you're lucky that you merely cracked the screen, or that it didn't find its way into a storm drain. You're lucky that you could afford something so nice to begin with. You're unlucky to have been in a fender bender, but you're very lucky to be alive after the fact, or that nobody else got hurt. You can bear the negative effects of those experiences, so when they happen, take a healthy swig of gratitude.
When you adopt a resilient attitude, you transform bad luck into good luck. Or, at the very least, better luck. You find a way to shoot the gap and lessen the pain. Remember, things can be much, much worse. You'll always be lucky they aren't.