Nicotine is an allelochemical. All plants naturally produce scores of these chemicals to protect them from herbivores, pests or contesting plants, to grow and to reproduce. Very little research has been made into allelochemicals (apart from nicotine!) but what little has been performed suggests that many could be toxic (in the appropriate dose) or even carcinogenic.
Nicotine is produced by the tobacco plant to repel pests. Nicotinic pesticide is approved for organic farming use.
Additionally, the pharmaceutical industry is trialling nicotine-based drugs to treat a range of medical conditions from obesity, dementia and psychotic disorders, as well as for pain relief.
P.S. Nicotinic acid is a byproduct of the oxidation (burning) of nicotine. It is also known as niacin and Vitamin B3.