On Friday I did a short 14 hour dry fast, later that night (10 hours after breaking it) I could not get to sleep at all until I went downstairs and drank a reyhdration sachet drink (and ate a banana), when I went back to bed I felt so relaxed it was amazing and I must have fallen to sleep straight away.
So I think an electrolyte imbalance could even cause insomnia, something I might look into some more.