You know the feeling: you were just thinking about a song, and you hear it on the radio. You ask for a sign telling you which path to take, and you see a person with a tattoo saying, "Go for it!" You miss a flight only to find out later that the plane crashed. Why did that happen?
There are many explanations for what is going on when things like this happen to you. But first, let's start with the two possibilities regarding why things happen:
Now, given those two possibilities, there are many more reasons why you might see things that have meaning:
So which is correct? Well, it's possible for multiple of them to be true, such as your brain both priming your perception going forward and reflecting and seeing the benefit of your past life experiences. The only thing that is less likely is that everything is random and there is a non-physical influence, though spiritual teachings even suggest that this is possible, differentiating between the two as "attracting by default" (random) vs. "deliberate creation" (not random). So even if you're a pure atheistic empiricist, a spiritual practitioner, or even a religious scientist, you might have a combination of several items above explaining what causes you to find meaning in things. You can use priming, for example, to focus on the positive things in life and you'll either be exercising priming, hindsight, and conscious attribution or maybe it's God or the Universe responding to them. From a "what benefits you" (vs. "what's true") perspective, all that matters is the positive outcome and not what really happened to cause it.
So the moral of the story is that things happen in your life and you have the option to assign meaning to them or not. Unless a non-physical being appears to you and provides that spiritual beliefs are true, you'll never get a provable, scientific answer to whether anything non-physical is doing anything. So you choose whether something matters to you. It's why something seemingly inconsequential one moment can be one of the most important things that ever happened to you a few moments later. You choose whether to find meaning and significance in something or not, and so you decide whether something "happened for a reason" based on whether it changes how you think or behave in the future. If you almost get hit by a car when you are a child and then later remember that and avoid getting hit later, then that first experience saved you in that second experience. It might have not had intention backing that experience, but you now know that the lesson suddenly had great significance as it protected you years later.
Use all of these possible mechanisms to your advantage. If you are purely a scientific person, you can use priming, coincidence, selective memory, pattern recognition, hindsight, preparation meets opportunity, and conscious attribution to shape the significance of your life. You can practice self-defense so when you actually need it, you'll react unconsciously and save yourself or someone else. If you achieve success, you can look back and see all of the hard times and how they made you better so you could be successful. If you have plenty of evidence suggesting you shouldn't do something, you can decide not to do it. If you are a spiritual person, you can see these patterns as signs, look for events in the real world to reflect back your desires and beliefs, and take certain situations as guidance from God or the Universe to take a certain path. The only reason why "reality" would matter is if you made the wrong decision thinking it was a sign, but Type 1 and Type 2 errors (meaning thinking it's significant and it's not or thinking it's not but it is) are possible no matter what you believe. The only difference is whether you are open to the risk/reward of following what might be divine guidance or just your imagination—mainly, avoid con artists or scams who use your beliefs against you.
So while we'll never know whether something happens for a reason beyond the physical intentions of humans in our physical world, we can always find meaning in something, thereby making everything happen for a reason—a reason we assign to it. So, like the "tree falls in the woods" question (where whether the tree makes a sound depending on whether you define a sound as a vibration or something that a person senses with their ears), whether everything happens "for a reason" depends on whether you mean a non-physical cause to random events (i.e., events that don't have an obvious intent from a physical being) or whether you can assign a meaning to anything in your life. In the former definition, we'll likely never know in a scientifically provable way, but in the latter it's completely in your control to make that true or not based on how you decide to view the events in your life.