If your iPhone is password protected and you'd like to perform a factory reset, you'll need to connect the device to your computer and perform the task in iTunes. iTunes contains a "Restore" option that will delete all of your content off of the device and return it to the way it was working the first time you turned it on. You don't need to know your iPhone password--you just need your iPhone's USB cable.
Plug your iPhone into your computer via the USB cable.
Click the "Settings" drop-down menu.
Click the "General" tab from the "Settings" menu.
Click the "Reset" button and select "Reset all iPhone Settings" to reset your iPhone without using your password.