Without losing data!
- Download correct Android factory image from Google (e.g. for Android 4.3 on Nexus 7 wifi: https://developers.google.com/android/nexus/images#nakasijwr66v)
- Flash the new bootloader from the image (e.g. for Android 4.3 on Nexus 7 wifi: bootloader-grouper-4.23.img)
- adb reboot bootloader
- fastboot flash bootloader bootloader*.img
- fastboot reboot-bootloader
- Update to new version of Anroid by updating from the factory image
- fastboot update image*.zip
Done! No data or user account deleted!
Rooting a Nexus 7 is very easy but requires an unlocked bootloader and a custom recovery. I recommend using TWRP.
- Flash TWRP from here (fastboot flash recovery FILENAME.img).
- Reboot into recovery (adb reboot recovery or hold Power+VolDn, then select Recovery).
- Flash SuperSU from this post. I’ve seen some people complain that doing so via CWM doesn’t work, but flashing through TWRP and selecting Fix Superuser Permissions at the end does the trick.
- You should be rooted.