I think the questions to ask first would be: what are you doing in the hours before you to go to sleep?
I generally need "chill out time" before I go to sleep. It's especially true when it comes to playing games. I try to cut myself off from playing anything well before bed time so my brain isn't fresh off of vidya games when I try to sleep. It's guaranteed to make getting to sleep take longer. So I don't really do anything electronic. No TV, no tablet or phone or constant forum browsing. I try to read for about 30 minutes to an our before bed, which does wonders for getting your brain ready to sleep. (Unless it's a book you're super into.) Getting anxious because you can't get to sleep is another thing that can extend the time it takes to get to sleep.
And then there's what you're eating or drinking. I try not to drink any caffeine after like 9pm on the week days. I'm not overly sensitive to caffeine, as I drink a shitload of coffee on a daily basis, but as I've gotten older and I have real responsibilities, I've tried to establish a pattern so I'm not dead on my feet in the morning. Sugar is another thing that will keep you up, but I likes my late night dessert so I don't necessarily avoid it before bed. But you might be more sensitive these things.
If you're physically anxious for whatever reason, you could try working out a bit an hour or two before you want to go to bed. Exhaustion can help you get to sleep, but working out can also get you amped up and make it harder to sleep, so you don't want to work out too much or too soon
before you want to get to bed.
What I do when I
really need to get back on schedule is....sleep deprivation. Struggle through that crash period by whatever means necessary, and tough it out to around an early bed time. (I generally try to get to sleep by 1am, so when I'm doing this technique I try to shoot for a 9 or 10pm bed time, to give myself a few extra hours of sleep.) It's not for everyone though, I'm only used to it because I pull a lot of bender gaming weekends, so sleep dep is kinda like a hobby to me
Generally when I for real can't sleep though, it's because something is off. Either I'm troubled or distracted or unhappy or something. So consider a lot of different sources for why you can't drift off. My first guess would be though: too much time in front of the PC and not enough time actually getting ready to go to bed. Like I said, turn off all your electronics, turn off the lights except a lamp, get a book and get comfortable. Usually does the trick for me.