My mother would talk for several hours at a time and has only recently started to talk less. She would sometimes make herself hoarse talking. A professional told us it can provide two functions. That firstly, it is what is called self-stimulating. So she had no way of having a proper conversation or mental stimulation, so talking away is a way of giving herself this sort of stimulation. It is like an extreme version of myself when I have been on my own too long I will talk to myself about my shopping as I go around the supermarket.
The other thing about it, where it may be repeated phrases over and over again, the same professional thinks is like a way of the person trying to sort of calm themselves with words. I am not sure I buy that, as Mum could get quite agitated while repeating things but it is one theory on it.
In term of how to deal with it, maybe some other distractions might help, such as music, singing, cooking, crafts and trying to get her to engage with things.
As for how you feel about it, I know it sounds cruel but you have to sort of disengage your brain a bit to cope with it. In normal life we would try to always listen to someone and respond. With my mother, I do make sure I give prompts every now and then or say something to show I am 'listening' but in fact I switch off. It's the only way I could cope with it. She is much quieter now, she still rambles on, but is towards the end of her life now.