I've come across this problem many times before, and after some testing I think I've isolated the issue.
The game should check the time that the character was last online and award rested xp as soon as you log in. Once you log out, the game should update the "last online" time. However, the rested xp is only awarded after you've successfully loaded realms (can see character, chatbox, etc). This means that if you log out while you're still loading realms, the "last online" time is immediately updated even though rested xp hasn't been awarded yet.
This has frequently occurred for me since my default server is OC upon booting client. It takes about 20 seconds for me to load. While loading, I'd open my friend list and perhaps see that plenty of my friends are on another server, so I'd log out before I'm done loading realms. The end result is that the server thinks I was last online 1 minute ago and I get no rested xp.
The rested xp needs to be awarded upon logging in even while loading realms, not after loading realms.
Edited by Brioche, 24 January 2016 - 16:25.