Facebook lets you choose in advance between two options. If you make no choice, a memorialisation request from someone with the proper documents can still be made after you pass away.
Appoint a legacy contact
A legacy contact looks after your main profile once it is memorialised. They can accept friend requests on behalf of the profile, change the profile picture and cover photo, and ask for the profile to be deleted. They can also download a copy of what you shared on Facebook, if you have turned this feature on. Nobody can log into a memorialised profile, so a legacy contact does not get your password or messages. A memorialised profile with no legacy contact cannot be changed.
Delete after death
You can instead choose to have your account permanently deleted once Facebook receives proof of death. Your messages, photos, posts and information are then removed. Tell your loved ones which option you chose.
Legacy contacts are available for your main profile only, and not if you are a minor.
Legal basis and further reading
General information, not legal advice. Settings on third-party services can change, so check the service before you rely on it.