Settings, then General, then Transfer or Reset iPhone, then Reset. Choose carefully:
Reset All Settings: puts settings back to default (Wi-Fi passwords, wallpaper, notifications). Keeps your photos, apps and data.
Reset Network Settings: forgets Wi-Fi networks, Bluetooth pairings and VPNs. Fixes most Wi-Fi, mobile data and Bluetooth problems.
Reset Keyboard Dictionary: clears learned words.
Reset Home Screen Layout: puts app icons back in the original order.
Reset Location and Privacy: asks apps for permissions again.
"Erase All Content and Settings" (on the previous screen) wipes everything. Only use it after a backup, for example before selling.