What would it mean for someone to die in vain? I had a dream where my grandmother visited me outside her home six months after she had passed away. As I rushed to her with tears in my eyes she stated, "Do not come any closer or else the sunshine will not show me." Then she said, "I love you more now than I ever did, even if I did die in vain." She handed me a piece of paper to show me that this was a real event and then slowly faded away. I awoke in tears and wrote down everything I could remember from start to finish about the dream. Then just last month I found a copy of the letter. It was then I remembered the, “even if I did die in vain” part and now I am curious as to what that could have meant.
Quite an imaginative story, but one that I cannot accept as true. When David's son died, David stated, "While the child was alive, I fasted and wept; for I said, 'Who can tell whether the LORD will be gracious to me, that the child may live?' But now he is dead; why should I fast? Can I bring him back again? I shall go to him, but he shall not return to me" (II Samuel 12:22-23). David understood that people who died do not return to this world. Job stated the same: "As the cloud disappears and vanishes away, so he who goes down to the grave does not come up. He shall never return to his house, nor shall his place know him anymore" (Job 7:9-10).
But to answer your question, "vain" refers to actions that are useless. For example, it would be vanity to stand outside and start huffing and puffing in hopes of changing the course of the wind. You can blow until you are blue in the face, but your effort would be useless.
The Bible uses the phrase "died in vain" just once when Paul stated, "if righteousness comes through the law, then Christ died in vain" (Galatians 2:21). By this Paul is stating that if a person could earn their salvation through perfect law keeping, then Jesus' dead on the cross as a sacrifice for mankind was an useless action. If men could save themselves, then they wouldn't have needed a savior to die on their behalf.