How do I perform a factory reset of my iPhone?
Doing Erase all Content and Settings from Settings / General / Reset will do the trick.

This process will remove all settings and information from the device, letting you configure it from the very beginning, as if you had done a reinstall.

The process won't delete nor modify the iCloud's account data.

Bear in mind, then, that you should either have an iCloud or iTunes backup or be sure that every possible information synchronizable with iCloud is, indeed, synchronized. To do so you should go to Settings / iCloud and check what's enabled and what's not.