This question already has an answer here:
There are a number of questions on this site about the protection spell that Lily gave to Harry through her death, but one question doesn't seem to have been touched on:
Why aren't such spells commonplace?
This question and its answers make it clear that the intention to sacrifice yourself is a vital part of the spell, but even so, would that really be so uncommon? The books make it sound like Harry's protection is incredibly rare, even unique. But Rowling herself, quoted in that question, says...
Now any mother, any normal mother would have done what Lily did.
And not just mothers! Many fathers and grandparents would likely do the same, even friends or lovers. Wars and armed conflicts inevitably lead to stories of comrades "throwing themselves on the grenade" to save their cherished friends. Hell, plenty of famous/powerful people have bodyguards whose whole job is to "jump in front of the bullet." Now maybe a Secret Service officer doesn't have enough love for his protectee to make the spell work, but within the novels I'm sure Harry, Ron, and Hermione would have been willing to sacrifice themselves for the others at any point, and that certainly would have been out of love.
Now, I'm not saying that everyone has people sacrificing their lives for each other everyday, but wouldn't that kind of protection spell still be fairly commonplace? Especially during a time of strife, like during Voldemort or Grindelwald's rise and reign? It seems like the more dangerous the era, the more often people would be making this kind of sacrifice.
Why would this kind of spell be so rare, given how natural the impulse to protect your loved ones is?