I saw an interesting vid on YouTube about a man who was relatively young, IIRC. He was in the C-suite of of a biotech company, but he suffered from some kind of dementia. I don't think it was Alzheimer's though. He slept in a separate room from his wife. He complained to his wife that his bed headboard was "rusty". As far as I could tell it was just an ornately carved headboard, and he somehow equated some of the carvings as rust.
There were other incidences like he would go through his wardrobe at like 2am in the morning. He appeared to want to sort out his shoes so that he could put them in his car. So there was something of a mess on his bed with wardrobe contents strewn out on it. He wasn't achieving much of anything, and of course there was no reason for him to sort out his shoes. Especially not at 2am.
It seems as though dementia sufferers do have some kind of "logic" to their behaviour, but it appears to be some kind of random logic without any discriminative faculties. And they fixate hard on this rationale too, making it particularly frustrating for those around them.
What's interesting, and actually quite well documented, is something called "terminal lucidity". This is when as someone actually gains mental clarity for a period of time some time before their death. The specific time periods vary with the sufferer. This is baffling medically, of course, because if a person's mental function is gone due to brain decay, then how can they get it back? And why does it foreshadow death?