There is an average of 65 shark attacks per year world wide over the last ten years.. About 5 per year on average are fatal. Considering how many thousands of people are swimming, diving, surfing in the worlds oceans that doesn't seem like very many.
And per the discovery channel, sharks don't like humans. Usually they think we're a big fat seal and take a bite. When they figure out we're not something they want to eat, they let go.
As to how to avoid shark attacks, that's very simple. Don't go in the ocean. :)