
Bad sleep and insomnia can be caused by a variety of reasons and factors including the following:
mental health conditions (anxiety, depression, PTSD)
medication which is disturbing your sleep-wake cycle
physical conditions such as chronic pain, being over caffeinated
environmental conditions such as light and noise