I occasionally perform such a reinstall on my Windows PC. I repartition my hard drive, format the partitions, and then install Windows on a blank partition. Can this be done on an Android smartphone? (I have an unlocked Sony Xperia S.)
Yes, it's very possible. Basically you can flash a ROM (custom or stock) very easily, and this is equivalent to a full format and reinstall.
Basic steps would be:
This is covered more in depth at these links (XDA is a great resource):
"Guide" to flashing the Xperia S (it's a fairly light-on-detail guide though, it is a very simple process)