[Nexus S Q&A, Help & Troubleshooting] SamuelDebruyn:
Ok, you'll need a Windows computer to fix this. Linux should work too but if you're using Linux I guess you could figure out what would be the instructions for Linux yourself. Mac would work too but I don't know how.

Download and install the Android SDK on your computer from http://developer.android.com/sdk/index.html

Open the SDK Manager (there should be a shortcut in your start menu) and install "Android SDK Tools" and "Android SDK Platform-tools" and "Google USB Driver" (it's in Extra).

Turn your phone off, take the battery out, look at the bottom of the phone and write down the model number.

Now go to https://developers.google.com/android/nexus/images and download the factory image for your model for version 4.0.4.

You'll need something like 7-Zip (http://www.7-zip.org/) to open it.

Copy image-so....zip, radio-crespo...img and bootloader-crespo...img from the factory image to the platform-tools directory (on most computers it will be C:\Program Files (x86)\Android\android-sdk\platform-tools and you'll need Administrator rights).

Now open the platform-tools directory from the Android SDK and right click on an empty space while holding the SHIFT button and select "Open command prompt here".

Put the battery back in your phone and press Power while holding the Volume-Up button so it will boot into fastboot mode. Then connect it to your pc.

If Windows starts complaining about drivers then point it your SDK installation directory (include subfolders) or use 7-Zip to unpack http://www.mediafire.com/?5a7gou9droidi53 and point Windows to the directory where you unpacked it. More info on http://www.sevenforums.com/tutorials/97061-driver-install-device-manager.html

When you type "fastboot devices" and press Enter in the command prompt you opened before it should list one device (being your phone).

If you haven't unlocked your phone before type "fastboot oem unlock" and press Enter. Follow the instructions on the screen on your phone to complete the unlock.

Next type "fastboot flash bootloader bootloader-crespo...img" (you can press TAB to auto-complete) and press Enter. (THIS IS THE MOST IMPORTANT STEP, IF THIS GOES WRONG YOUR PHONE IS SCREWED. Don't continue if another step didn't succeed. If this works, then you can do anything with it.)

Now type "fastboot reboot-bootloader" and press Enter and wait for your phone to reboot into fastboot mode.

Next type "fastboot flash radio radio-crespo...img" (you can press TAB to auto-complete) and press Enter.

Now type "fastboot reboot-bootloader" and press Enter and wait for your phone to reboot into fastboot mode.

Next type "fastboot -w update image-....zip" and press Enter.

Now type "fastboot reboot-bootloader" and press Enter and wait for your phone to reboot into fastboot mode.

Next download http://download2.clockworkmod.com/recoveries/recovery-clockwork-6.0.0.7-crespo.img and also put it in the platform-tools directory.

Then type "fastboot flash recovery recovery-clockwork-6.0.0.7-crespo.img" and press Enter.

Now type "fastboot reboot-bootloader" and press Enter and wait for your phone to reboot into fastboot mode.

Now use the volume keys on your phone to navigate to the word Recovery and press the Power button to boot into recovery.

You're now in CWM Recovery, use the volume keys and the power button to go to Mounts & Storage > Mount USB Storage (you might have to scroll down). Now it will come up on your pc and you can transfer the update file for Jelly Bean to your phone. You can find it here: http://xdaforums.com/showpost.php?p=27965168&postcount=1 (use the one for your model for IMM76D).

Unmount the usb storage, go back to the main menu and go to Install Zip from sdcard > Choose zip from sdcard and open the update file you just transferred to your phone.

You can now go back to the main menu and choose "reboot system now". It will ask you if you want to remove the auto recovery installation, do that.

That's all, you now have a clean and working Jelly Bean installation.

Someone else wrote down the same instructions if mine are not clear enough: http://xdaforums.com/showthread.php?t=1785672