What is the history of how most plants that are poisonous raw were discovered to be safe when cooked. How did people in the past look at something that caused death or sickness and still decide they would try eating finding a way to eat it?
This is a very good question. It is the kind of question that seems simple on the surface, but upon looking into the answers, we see the complicated history of human survival, as well as the hidden assumptions in this question that make it seem more mysterious than it is.

The are several reasons that a person might try to eat a food that is toxic. The first, quite simply, is that sometimes the plant is less toxic than the person is hungry. A plant that causes cramps might be the only source of calories available, and people might try using cooking as a way too attempt to make those plants more palatable. They may then find that these plants that otherwise are toxic are now nutritious and no longer harmful. Many of the toxic plants that must be eaten cooked (or otherwise processed) are not killers even raw, but rather are unpleasant in small quantities and require very large quantities to cause more than short-term discomfort and harm. 

Another way that this can be discovered is through accident. Imagine a plant being left near a fire, after which birds or small animals are willing to eat it. Even early humans were just as intelligent as you and I, and had to be incredibly observant to survive the world around them. You can imagine them using this sort of observation to inform their own decisions about what to take risks to try.

And this can be extended further. It's possible that even in pre-history, humans made systematic observations when encountering new plants. We know that prehistoric humans spread very rapidly at times, and would have been encountering many plants and animals for the first time. It's possible that those people who explored often knew to always try eating a plant cooked for the first time. 

Finally, it's possible that the practice of eating raw plant foods was lost for a long time. Just as we now cook all of our meat, maybe the real question is the prehistoric people looking at us, wondering how we possibly discovered that some of the foods we take for granted are poisonous is not prepared first.
Okay then, so how did people learn they could eat some of the really crazy things we eat? Like rotten fish or century eggs. That kind of gross stuff that normally you'd assume is unsafe to eat.