Go to Settings → System → Reset → Erase all data (Factory Reset).
Remove SD cards and SIM cards before selling.
Encrypt your phone first before factory reset for additional security: Settings → Security → Encrypt Phone.