How do herbivores know a certain plant is poisonous?
Do they have instinctive knowledge?

I don't think there is a single answer here. Instinct plays a role in cases, as does learned knowledge (e.g. in some animals parents may "teach" offspring about useful food resources) and/or experience (some toxic plants will taste bitter and a curious herbivore may be put off there and not ingest enough to do serious harm). Many plants also utilise chemical or even visual warning signals of various types.

Some good general info in the wiki page here … _herbivory

agreed though I would expect that genetics would play the major role. By that I mean that it is likely that animals that have genetic changes (polymorphisms as opposed to mutations) that either made the animal more resistant to the toxin or more likely meant they didn't like the taste or smell or colouring of the plant and thus didn't eat the poison would be more likely to survive and thus those survival traits would be selected for.