Factory data reset
This setting allows you to wipe all personal data, configuration and customization from your device, restoring it to factory condition. This may be useful if you need to sell your phone.
Upon initially selecting this option you'll be taken to another screen with more description of what will be wiped, warning you that your personal data will be lost. The reset will not occur until you have confirmed this second step.
What is included
SD cards
Some Android devices accept an external Micro SD card (or other external storage) in which case a factory reset usually won't affect the data on such a card. To be sure, it would be safest to remove such a card before performing your reset. If you need to wipe the information on that card, you should reformat it using other tools, such as an option under the "Storage" settings menu.
Internal storage
Android devices usually contain non-removable internal storage for your data, which may include photographs and downloads. On modern Android devices this storage area usually will be included when resetting. It is important that you transfer files from your device that you wish to keep prior to a reset. Data in this partition probably won't be backed up using Google's backup service, and it is always a good idea to keep your own backups of your personal files.