Where do you start.....
There are so many reasons that ones sleep can be affected.
For me, personally, it was a mental challenge. The more I dreaded "trying" to nod off, the more my mind would wander and not allow me to sleep.
I can only vouch for myself, as its a very individual thing, but I exercised more, eat better and it lessened my anxiety at night. I used to take a large whiskey to bed but then got quite shocked that I was having a bottle a week, so stopped that.
Yes, medication will work with some but then the matter of dependency can creep in.
Therapy, is another route.
The internet is full of insomnia websites and chat rooms. Once you do some research, you will realise your problem is shared by millions. Sometimes for isolated periods, but, often prolonged.
Find what works for you, like I said, for me, it was lifestyle changes... Healthy body, healthy mind