There are two main ways to upgrade from ESXi 3.5 to ESXi 4.0. Both methods perform an in-place upgrade of ESXi, which allows the following:
- preserve VMFS and all contents on local disk, if upgrading ESXi Installable
- upgrade ESXi embedded, whether on internal or external USB key or internal flash memory
- preserve almost all configuration data, including your networking, security, and storage configuration. The only configuration not preserved is related to licensing, because a new ESXi 4.0 license is required after the upgrade.
If you are using vCenter to manage your host, the best way to upgrade is to use vCenter Update Manager. You need to update your vCenter to vCenter 4.0 first, but that can be a first, separate step since vCenter 4.0 can manage both ESXi 3.5 and ESXi 4.0 systems. vCenter 4.0 Update Manager has been enhanced to specifically perform the upgrade process for both ESXi as well as ESX. VMwareTips has a nice video showing the entire upgrade process with Update Manager.
If you are not using vCenter, then you can use the standalone Host Update Utility to perform an upgrade. This tools installs on any Windows host, and can be used to upgrade any number of ESXi hosts. VM Help (the home of the unofficial ESXi Whitebox HCL) has a nice overview with screenshots of using Host Update Utility to upgrade ESXi 3.5 to ESXi 4.0.
More detail on the upgrade process from ESXi 3.5 to ESXi 4.0 may be found in the vSphere Upgrade Guide