It is best to learn to identify mushrooms from an expert in the field. There is a great deal of variation between individual mushrooms and also in how a mushroom with look at different stages of development and in different growing conditions. Any form of mushroom guide (book or online) will have difficulty expressing these variations.
Learn the most dangerous poisonous species and be confident in your identification. There are relatively few really dangerous species. If you know and avoid these, then you shouldn't be able to do yourself any lasting harm.
The key to not poisoning yourself is good identification. Be absolutely sure of what you are eating before cooking it. Check ALL of the relevant features and discard all mushroom which do not match them all. If in any doubt don't eat it!
Don't assume that all mushrooms you find together are of the same species; different species can be found together. Check every specimen.
Don't pick specimens that are too young. In their early stages many of the necessary identifying features may not have developed.
Don't pick old or moldy specimens. Even if they're an edible species, they can make you as ill as eating any other food that's gone-off.
As with any food you gather, avoid collecting in polluted or industrial areas. Mushrooms tend to absorb heavy metals from their environment.
Sort through your collection as soon as you get home and double check the identities. You now have time and comfort to check the features more carefully than you may have in the field. Take this final opportunity to discard anything you're not certain of.
Even if you feel certain of your identification, if this is first time you'll be trying a certain species, only try a very small amount and only eat that one species. This will reduce any effects of a misidentification. This will also help if identification was right but it disagrees with you.
When trying new species also keep a sample of the same collection in fridge for at least a couple of days after first eating it. This can be used to get a professional identification if you do become unwell.
If you believe you or someone you know may be suffering from mushroom poisoning seek medical help.