Does becoming martyr have an evolutionary advantage?
There isn an effect called "Indirect reciprocity" where individuals just give to everyone they meet without direct requirement of reciprocity.  

This sort of benefit to others is common - hospitality to strangers, general politeness, good customer service all fall along these lines.  You hope they will come back and benefit you again, but maybe they will tell someone else who will know you are a good community member. 

It is only sustainable in a system where the cost/benefit ratio is less than the reputation benefit of the act.  It sounds as if this is only good for public acts but if the benefit is transferred to a social entity that outlasts the individual (like your children, a relative's children, a religion or a corporation say), the result could still hold.  

If you think about typical morality/ethics really it still makes sense to think that what we call altruism must still have a net positive benefit.  If there is no benefit long term or to anyone, it really isn't useful or even good, its random.  What we usually call altruism is usually some sort of reciprocal cooperation.  

A soldier who dies in combat or someone who dies for their beliefs but everyone knows about it as a public statement benefits from their act indirectly.  I don't think its altruism in the pure sense of the word. Defending the nation, ones' beliefs or whatever is, in its sense its own reward.  Veterans come back from a war are hopefully respected for their work.  Having a purple heart can be a good thing to show people.  I'm not saying these people are adequately compensated for what they have been through, but just trying to draw a distinction between pure biological altruism and 'indirect reciprocity'.

Examples of Indirect reciprocity might be the use of tax money to build highways and build power and water infrastructure.  Its important - its the glue that holds a nation or a group together.  If you got punished for doing these things we wouldn't be hanging as a nation very long!

A martyr with no family at all who would benefit would still count as an altruism I think, but most acts of public piety and sacrifice do benefit the individual by reputation. Something to think about.