1) Get shot in the chest.
If you get shot in the head, you're dead or changed forever, but get shot in the chest and you're definitely surviving. Though you might spend a few episodes having your team tell you that you should really take it easy, Boss, and then doing some heavy breathing when you ignore them.
2) Get picked up for another season.
If you have more episodes ahead, don't worry, forge ahead, you'll probably be fine. Are you the main character? Are you picked up for your sixth or seventh arbitrary season? You can be pretty chill about this whole avoiding near-death situations. Roll your windows down, loosen your gun holster. Drug raids, etc., are now BPVO (bulletproof vest optional).
3) Be a love interest.
Have some sexual tension with the character tasked with saving you. You'll be fine. Wait, are you a male love interest on a lady-power detective series? Never mind. You're fucked, man.
4) Never have it be the first episode you're on.
Never, NOT EVER, be the less than likeable new colleague who goes into a shootout in your first episode on the show. The story is bound to be punctuated by your violent death, possibly after you shoot an equally dispensible character in the head.
5) Be one of the "good guys."
Be a detective, lie detector, agent, mathematician, spy, US Attorney, hot girl, serial killer, criminal profiler, scientist, psychic, or bureacrat tasked with solving the impossibly frequent and fascinating crimes. Unless it is a season finale, never be personally involved in a case. If you make your first appearance being one of the suspects (i.e., guy unloading boxes, a seemingly normal couple with a secret, bartender), you are basically dead. Your death won't even be seen, the real characters will just be informed of it via telephone.
Good luck. I think you should go, another attractive female navy officer was strangled.