Insomnia can be caused by many things.
Stress, panic, depression, psychological distress, anxiety, depression, and more can affect your sleep process.
Your daily lifestyle, diet, exercise, medications, alcohol, and smoking can also cause insomnia.
Insomnia can also be caused by some diseases (kidney disease, osteoporosis, respiratory disease, neuropathies, etc.) or medications (antidepressants, anticancer drugs, antihypertensives, acupuncture needles).