There are many reasons why you can have insomnia
Hormones - lack of melatonin production
Watching TV before sleep means less melatonin would be produced, same is true if your lights are bright
Food - eating certain foods in the evening means your body will produce too much energy
Tea, coffee etc contains caffeine, their effects last from 6-12 hours depending on the person - result poor sleep
Alcohol - gives you sleep without REM, ...