Part of it has to do with people’s perceptions of you vs. who you really are.
For example, I’ve been in IT for a long time and so have many of my associates, and we all have our specialties. Yet people assume all sorts of things about our skills, and we often get asked to do things tech related that are not related to our specialty simply because we’re computer savvy.
The web designer will be asked to build a computer, and the network tech will be asked to create a website, and a mainframe or Linux computer operator will be asked for help on Microsoft Word, the technical writer will be asked if they can program a iPhone app, etc. Sure we all have skills that cross specialties, but none of us knows everything or even wants to. Yet people make assumptions.
So people endorsing you for skills you don’t have is related to your reputation and what skills people assume you have. Some people endorse you based on their personal experiences with you, while others rate you based on your reputation and assumptions about you. Sometimes it can be very revealing about who your peer group really thinks you are.
Another part of it is LinkedIn making suggestions about possible endorsements based on what skills LinkedIn thinks you have. Some people assume you have a skill because LinkedIn or others think you have that skill. Since they like other things you do, they endorse you for other skills they think you have.