My 10 year old has battled with off/on insomnia since she was about 6, she also has ADHD.
Melatonin was not a good fit, she got aggressive on it.
Some days are just better than others. Is your 6 year old on long-acting or short-acting meds? When they are given can make a huge difference.