Go to Settings > System > Reset options > Erase all data (factory reset) > Erase all data. After the erasing process, set up ...
Even if the display of your phone or tablet with iOS/iPadOS or Android is damaged and operation is impossible, there are various ways to recover your data. However, there is no guarantee of success.