Insomnia can be caused by many lifestyle factors and medical conditions. Here's how to determine what's disrupting your sleep.