In 2015, Facebook had announced something called as legacy contact. This means you can designate a contact who can pin a post on your Timeline informing others about your death. The legacy contact cannot access your account or read your messages, but will be able to change your cover photo, profile picture and even respond to friend requests.
Under Settings > General, you can assign a legacy contact. You can choose a name from your Facebook friends list. A write-up will pop-up that you can choose to send to your legacy contact informing them about it.
After a person's death, you can write to Facebook and get the account memorialised. The word Remembering will be shown next to the person's name on their profile. Friends and family can still share memories here. You also have the option to memorialise your own account after death. It means, no one can log into your account and it is as good as frozen.
A verified immediate family member can also request for the removal of the account from Facebook. It will permanently delete that account.
And, you can choose to opt for these option right now! Under Settings, under the General tab you can simply choose to delete your account after death or memorialise it. This will happen once Facebook is notified about your death.
If I Die App
'If I Die' is a Facebook app that lets you create a video or text message, probably a last wish or something you want everyone to know, which will be posted after you die. The app lets you choose three friends, and only once these three confirm you are dead, the messages will be shared. You can check out the app here.