An excerpt from the blog on usa.gov:

Take these steps to help you write a social media will:
• Review the privacy policies and the terms and conditions of each website where you have a presence.
• State how you would like your profiles to be handled. You may want to completely cancel your profile or keep it up for friends and family to visit. Some sites allow users to create a memorial profile where other users can still see your profile but can’t post anything new.
• Give the social media executor a document that lists all the websites where you have a profile, along with your usernames and passwords.
• Stipulate in your will that the online executor should have a copy of your death certificate. The online executor may need this as proof in order for websites to take any actions on your behalf.

Read the complete blog post here.