Almost everybody has had this experience before important events or changes of the daily routine like going on holiday in a foreign country, taking an exam, or after an argument with a close friend or relative. So this type of sleep problems is usually linked to a higher stress level or the inability to calm down at night and stop worrying. But also extreme physical or mental activity close to bedtime (less than 3-4 hours before your usual bedtime) or illness can cause transient insomnia.
Usually no treatment is necessary or recommended. Sleeping pills usually will help. But you should not depend on a pill to find rest and sleep at night. It would be better to identify the sources of stress or worrying and to find a better way to relax in the evening, because of the risk of becoming dependent on sleeping pills.