In the 23rd episode of season 1 ("Skin of Evil"), Tasha Yar is killed. At the end of the episode, the main crew of the Enterprise holds a memorial service for her, where a hologram of her addresses each attendee. It looks like this, to jog your memory:

Also, totally the Windows XP wallpaper, right?
Anyway, why did Tasha Yar record this message? She died suddenly and had no reason to expect she was going to die (aside from the general acceptance of death one has when they are a serving officer). Is this something people do in the Star Trek universe, much like people have wills?
A side question: Since the message addresses individuals, how did Tasha know who would be at her memorial service?