Usually, an iPhone gives you some advanced warnings before it dies. The problem is, most of the time, people ignore these warnings until the iPhone actually stops working.
Here are five warning signs that your iPhone is about to die.
Ignore them at your peril!
This is a slippery slope towards death for iPhones.
I've seen this caused by a number of reasons (the most common is a damaged or defective display, but I've also seen the ribbon cable become detached inside).
One day that display will flicker its last.
Ghost touches are random touches on the display. They can be caused by screen damage or an internal failure. Increased temperature or flexing can make it worse.
This is something that gets worse over time and can end with a crazy level of ghost touches or a display that becomes unresponsive to touch.
Notice your iPhone has started to reboot randomly. This could be down to a myriad of reasons. Bad battery is high on that list (you'll get a message if this is the case), but it can also be as a result of a defective mainboard or even loose connections.
Uh-oh! Your battery is running out, but the iPhone won't charge!
Some things you can try:
This is usually a sign that the battery has swelled up.
This is not a good sign as a damaged battery is a dangerous battery.
Don't try to squeeze the iPhone back together, as this could damage the display or puncture the battery.
Do not underestimate how dangerous a defective battery can be. Do not charge it and get it fixed as soon as possible,
The iPhone is a brick.
Apple has a couple of support documents (here and here) that might allow you to fix it yourself. If it doesn't, then you have a trip to the Apple Store in your future.