Insomnia is a complex condition. Insomnia is when an individual has difficulty falling asleep or staying asleep even when they have the opportunity to do so.
Insomnia can be categorized by its duration, if it lasts for a brief period because of some stressful life events then it is called Acute insomnia, people suffer through this and get cured without any treatments. For eg, Exams, or some bad news.
The other can be due to the use of psychoactive substances like alcohol, drugs.