Apple introduced a new Digital Legacy feature in iOS 15 in June. It allows you to designate a person to be your Legacy Contact. This gives them access to your Apple ID account, personal information, and your Apple ID account in the event that you die.
Apple didn't include Legacy Contact in iOS 15's launch because the feature wasn't ready. However, it is available in the iOS 15.2 or iPadOS 15.2 betas released today.
You can access the Legacy Contact option by opening the Settings app and selecting "Password & Security" then choosing "Legacy Contact" in the list. You can then choose a trusted person who will be able to access your account after your death.
To access your Apple ID account, the person will have access. The contact will need an access key and a copy a death certificate. This feature allows your loved ones to access your photos, videos and documents.