What happens if I factory reset the phone after upgrading to Lollipop?
A factory reset only clears the user data from the device, it doesn't touch the system partition which is where the update was applied.

So yes, the Lollipop upgrade remains.