For me what has really helped me is using odd calculators after some bad beats. Once you start to realize you were only a 60 or 70 percent favorite it helps to realize that bad beats are going to happen from time to time. It also, helps me to improve my game by learning more about equity and is good practice for seeing what your actual chances of winning the hand were. I think experience helps too, the more times you take bad beats the more you get used to it and accept it. Plus, it works both ways we all win some hands that we shouldn't but we never seem to focus as much on those as the times we lose. Maybe if you write down some of the times you delivered a bad beat to someone else and look at them when it happens to you, you'll be able to better get over it realizing you've won in similar ways to how you just lost.
The worst thing you can do when losing is to bet more to try to get what you lost back. I heard a guy in a casino one time tell me he had a fool proof way to ensure he didn't lose at roulette. He would bet $100 on black (or red, or odd, or whatever). If he lost, he would bet $200 the next time on the same thing. If he lost, he would be $400 the next time on the same thing. His theory was that if he just kept betting the same thing and doubling his bet every time, he would eventually win and get all his losses back. I mean, the number can't come up odd (or red) 5 times in a row, could it? Yes, it very well could.
I could only shake my head.