Celebrim
Legend
I do not really grasp outside of being magic call and mystical in a vague sense what they bring to a setting and why a player might play them outside of magic being overly romanticised and being able to outlive most nations
So the purpose of elves is to utilize the very iconic role elves play or have been made to play over the years in Northern European mythology. They have massive mythic relevance in multiple ways in the Northern European myths that have shaped and dominated most fantasy up until say 10 years ago, when I think people began to lose touch with those myths and stories in much the same way that modern kids growing up are much less in touch with the Myth of the Old American West than my generation was. Since we've lost touch to many of the stories that made elves relevant to fantasy, we've lost touch to their purpose. Nobody lives in Northern European myth much anymore, and probably the only touch point people have these days is PJ's 'Lord of the Rings' movies and these themselves eschewed a lot of the mythic resonance of Tolkien's books in favor of being modern and proximate and easy to relate to for a modern audience that no longer has connection to the deep past.
One of the reoccurring motifs of Northern European myth is, "There was something here before us and they were better than us. We are but weak shadows of the Older Better Days." Tolkien interpreted that older better thing as elves, which was not entirely true to the overall lore of Northern European myth but was close enough. So that's one example of the purpose elves tend to play in settings - they represent the unsullied, unspoiled, better times before whatever happened that made the world unpleasant. They represent, "In the old times, they lived longer, they were stronger, happier, and more beautiful. And then we happened. We live in the less good times after the end of the Golden Age."
Pratchett who is also very steeped in English folklore, has them play a related but different role, and plays up the fear involved in something that thinks it is and you may be tempted to think actually is better than you, and uses them for that purpose in the story. His elves are arrogant beautiful predators, and that is also true to the lore.