Select Menu > Settings > Reset factory set. (or Restore factory set. or Restore factory settings). Enter the security code. Default security code is 12345. After that, the phone starts restoring without extra notification.
Restoring factory settings resets all settings to the default, but contacts, messages and other personal files are not affected.