Why people make "pity compliments"?

you know when out of nowhere they try to cheer you up saying you are great, talanted and you can do it, you are pretty, etc.
and you sit there and think... but im confident, I didn't say Im not.
like why people say it?
I understand they try to say something positive but it has kinda oppositve effect.
similar to when people say"not being rude, but...". they try to be nice but come out like arrogant or something, treating you like you are some miserable shit for no reason.
it's weird.
Why people make "pity compliments"?
Post Opinion