Factory resetting or Restoring as it is known it wipes all user data from the device and puts everything back the way it was when it was first taken out of the box. The iOS version is not changed however. If the iPhone was updated it will keep the updated iOS version, but will be at the setup screen for the new user to set up.
The New user will need to do exactly the same thing you did when you first set it up when you bought it. It will be in exactly that state assuming you follow the steps in this support document:
What to do before selling or giving away your iPhone, iPad, or iPod touch - Apple Support
The New user can then go through the setup process as you did originally.
You should only label the iPhone as unlocked if it was in fact officially unlocked from purchase or you had it unlocked by the carrier it was locked to at any point. Restoring will not unlock it if it is locked, nor re-lock the device in either of these cases.
If the iPhone was unlocked by any other mechanism, be it via a website or a service center it will likely re-lock when it is restored.
Follow the steps in the Article above to completely remove your Apple ID from the device so the new user can set it up with their own.