what is instinct?

In a posting in this site a few years ago, the team provided an answer to the question “Why are poisonous bugs brightly colored?”

http://www.straightdope.com/mailbag/maposematic.html

The conclusion of that post says “One final wrinkle is that this has been going on for so long now (several million years) that in many predators, the avoidance of warning-colored prey is instinctive–in other words, it is not always learned or taught.”

Last night I heard a talk on the radio (yes, I still listen to this ancient device) that dealt with a study in New Zealand trying to reduce the number of surfers who end up as shark-food. The nub of the matter is that people in black wet-suits look appetisingly like seals, and the researchers are trying out different patterns of colouring on the wet-suit to emulate fish that the shark “instinctively” know are bitter, or dangerous to them via poison or electric charge. They explained that there has been success in agriculture by placing tags coloured to look like bumble-bees on electric fences, so the cows don’t go poking their noses into the fence and getting killed.

The essence of my question is - what is instinct, where does it come from and where does it live? Is it a pre-set pattern embedded in the brain of the animal that somehow triggers a response? If so, that’s a pretty tall order for a a strand of DNA to code.

Please enlighten me.

Bear in mind that invoking processes that result in the development of a complete, functional organism is also quite a tall order and DNA does it for breakfast.

In a population of organisms, a chance mutation occurs that leads to a certain behaviour; if that behaviour happens to result in greater survival capability (i.e. aversion to something that is dangerous), more of the organisms will survive to pass on the gene that causes the behaviour. - The reverse is true; if the mutation happens to result in diminished survival capability, the population is more likely to die out.