Modern data storage devices generally store data within various sectors within the drive itself. Bad sectors occur when one of these sectors are damaged. Sectors can be damaged in a number of ways, including:
It's normal for modern hard drives to experience bad sectors throughout its normal lifespan. After all, every electronic device is susceptible to wear and tear over an extended period of time. When these bad sectors occur to a young or healthy drive, however, or if you're frequently experiencing new bad sectors, it's cause for concern.
Dealing with Bad Sectors
Bad sectors are a common cause of data loss in modern computing. If a sector containing information goes bad, that data will be lost. This is yet another reason why it's so important to backup your important data on a regular basis.
However, a bad sector doesn't necessarily mean the end of your hard drive. In fact, many bad sectors can be self-repaired using spare sectors that are contained within modern drives. However, the data that was contained within the original sector will still be lost.
In Microsoft Windows, for example, bad sectors can be repaired when checking a drive for errors. By checking the box "Automatically Fix File System Errors," the operating system will automatically attempt to repair any bad sectors it detects.
Some hard drive manufacturers also include built-in tools for diagnosing and repairing bad sectors. Consult the documentation that came with your hard drive for more information on accessing and using these tools.
Other times, a bad sector might be detected by the firmware of the disk controller. In this case, the data in the bad sector will be remapped to a different sector on the drive. When successful, this process happens transparently in the background. It also mitigates the data loss that occurs when a sector fails outright.
Avoiding Bad Sectors
Unfortunately, there are no tricks to avoiding bad sectors. While you can go to great lengths to minimize the risk of physical damage to your drive, every drive will experience a few bad sectors if it's used for a long enough time. Although some bad sectors can be automatically repaired via your OS, or manually by formatting your drive, this still results in data loss. Instead of trying to avoid bad sectors altogether, the best defense is a consistent and efficient data backup system.
You may read more about bad sectors in Wikipedia: Bad sector.