Shark attacks are very rare. Sharks usually feed at night and during twilight. Sharks are curious and may approach you. I have dove with white tips and hammerheads. After investigating you, they recognize you are not food and move on.
Sharks detect the electrical impulses in your muscles and bodily fluids like blood and urine. Do not confuse them with excessive splashing or attract them by fishing or chumming.
Sharks attack by first biting the victim once. They then let the victim die before eating the dead victim. If you are bit by a shark, if you can get to safety, you should survive.