How do you tell the difference?

I feel like lately, I've gotten a lot of bad beats. Things like losing with a king-high flush against an ace-high flush. Or a loose aggressive player reraises me preflop and goes all in when I'm in late position with pocket aces. He had a queen and an 8. Flopped one 8, and got another on the river to beat me.

And that's been happening a lot. Exactly that kind of thing, where I feel like I made all the right decisions, but still lost.

So am I just getting bad beats? Am I doing something wrong? Is there something I'm missing? How do you tell whether you've gotten bad beats or whether you're making mistakes? How do you tell if you need to just be patient and ride out a losing streak, or if you need to change your strategy?