In the flying community we face the same problem. In 10 years of military flying I've seen one friend, some squadron mates, several classmates, my orthodontist and his wife, and a former student of mine die in aviation accidents.
First, I'll tell you it doesn't get any easier. That may be a comfort to you since the pain is proof that you're still human.
How do military pilots deal with it? Any number of psychologically identifiable methods are at play but here is an amature's take on the whole thing.
When something like this happens, the first thing we do is take care of business. Someone gets to go pick up the pieces of the plane, the dead pilot, and someone else has to try to hold together the lives of the surviving family members. Records and evidence must be preserved for the obligatory investigations. Business first, and that keeps people busy for a while as the shock sets in.
After (or during) this initial timeframe, a lot of the time we go get drunk in the squadron bar or O-club. Everyone deals with it differently including getting angry, sad, expressing disbelief, trying to find an explanation, but right away what I've seen is we tend to come together as a group for a bit of mourning in the bar.
At some point there tends to be a transition to finding lessons learned. First, we learn from the person or people who have been lost. What can we learn from how they lived their lives? Ideas for appropriate memorials are dreamed up and brought to reality, knowing that a memorial should be be a triumphant celebration of a life, not merely a sad reminder of a death. We also learn from the incident itself. This can take on a very personal meaning if you're the instructor for a student who died, or someone who is doing the exact same thing as the one guy who didn't go home that day. Everyone re-evaluates their own conduct, taking home their own lessons learned.
And bravado comes into play, helping keep us from turning inward and thinking too much about all the what-if scenarios. Tradition helps focus people on the future. Ceremony is important when there must remain a focus on a dangerous mission even in the face of tragedy. It may be a simple thing. Our squadron bar has a place where every pilot or WSO who has been in the squadron in the last decade or two has left a nametag when they left. When one of them dies, and everyone dies eventually, the nametag is turned upside down. A simple thing, but it reminds us that nobody is forgotten. A toast to the fallen comrades, a toast to the future, a personal vow that it'll never happen to me, and one more coat of polish is carefully put onto the thick egotistical shell that surrounds any fighter pilot worth a damn. Under the shell may be a human, but damned if any outsider is ever going to find out and pass me another beer you ^*%(^%.
Because we all know at while we pretend it won't happen to us, and we try not to do the math that proves that the statistical probability we'll be directly involved with a fatal mishap approaches certainty throughout our flying careers, we still have a mission to do and holding on to defeatist negativity is the best way to ensure you're either going to be the next dead guy or completely ineffective.
It's different for every group. Fighter pilots fall back on each other, tradition, and a thick shell for an ego to deal with it. It's never easy but we have coping mechanisms that go back generations. Living an intentionally hazardous life (ie. skydiving for fun or profit) involves both a calculated risk and a decision about the relative value of the quality vs. quantity of life. The comparison between the dead hero and live coward applies to life in general, not just combat. How safe do you really want to be? Are there some things in life that are worth taking risks?
I tell you one thing I do know - I see people who smoke, drink, drive too aggressively, take drugs, etc. and they're risking their lives for things that seem pitifully trivial compared to the joy many people get from other high risk outdoor activities like rock climbing, skydiving, and flying. Yes, if you partake in any of these activities, whether it's doing drugs or flying, you're probably going to see the death of someone close to you much sooner than you'd like. The question is if the life benefits of that activity worth the risk? I know I've drawn the line for myself, and it's somewhere between flying fighters (fun) and bungie jumping (stupid and unnecessary).
Just remember that those close to you have faced the same choices and made their decisions, and honor their lives when they're gone.