"When diagnosing insomnia, a doctor will take a medical and sleep history. He may give you a physical exam to take note of any possible underlying health conditions. A sleep history could be in the form of a sleep diary where you would write down the times that you go to bed, when you wake up, if you have any trouble falling back to sleep or any other issues during sleep. A sleep questionnaire may also be used to look at details such as describing your bedtime routine and whether you have trouble staying awake for typical tasks, such as driving, and this can really help understand the severity of your insomnia. If you have a partner, they can also provide really important details that you may not notice such as loud snoring, or if you stop breathing in the middle of the night, you may also be screened for anxiety and depression, as these can also be causes of insomnia.
A doctor might also want to take some blood work to check for issues such as thyroid function or iron levels to see if there may be another organic cause. A doctor might also recommend undergoing a sleep study, especially if the cause of your insomnia is still unclear. You may be able to undertake the sleep study at home with a portable device, or you may go to a sleep study center during a sleep study. Several factors will be monitored, which include heart rate, breathing, rate, breathing effort, oxygen levels, muscle movements, sometimes brain activity and eye movements will also be monitored. The results of the sleep study can help develop a treatment plan for a diagnosable sleep disorder."