I recently answered a question on apple.stackexchange.com:
…I wanted to offer up some useful information that I learned from the Apple Store. The home button on my wife’s iPhone 4 was acting flaky, so we brought it in to a technician. After asking whether we’ve tried a soft, hard and factory reset, he notified us that, barring those solutions, they could replace the phone for $149 (not free since it is out of warranty). But then, he also offered a workaround that I was not aware of: AssistiveTouch.
Basically, this iOS 5 feature allows you to access some system-level functions from an onscreen menu. In particular, this gives you a software home button, and it’s baked into the OS! It even responds to double and triple taps. If your home button is flaky or broken, this is a robust workaround. This also comes in handy if any of your other hardware components are broken. You can mute/unmute, do a “shake”, adjust volume, and rotate/lock screen from this menu.
To access it, go to Settings->General->Accessibility:
Scroll down to the Physical & Motor and tap AssistiveTouch:
You will get an overlayed touch target, which opens a menu where you can operate the home button, among other things:
Using the Assistive Touch feature, you can also save custom gestures and initiate multi-touching using only one finger, although I haven’t found any use for this yet. There isn’t much documentation on this feature; it’s one of those hidden gems that will prove especially useful with aging hardware.