There are a couple of reasons--besides replacing a broken drive--why you might consider swapping out your Mac's hard drive. One is to increase your available storage capacity, and another is to better the performance of your drive. While most Macs ship with 500GB to 1TB drives that should be adequate for most home purposes, you can now get up to 3TB of data on a single drive, and the standard 7,200rpm mechanical drive crawls in comparison to the performance of some SSD drives these days.
Generally if you are just looking to increase the storage capacity of your drive, my initial recommendation is to consider other options for managing your data. Unless your installed programs and operating system are filling up your drive, you can likely migrate your movies, music, and other large media to an external volume to free up space on your boot drive without going through the hassle of replacing it. There are numerous high-capacity external storage options available, including expandable USB and FireWire RAID arrays that can accommodate up to numerous terabytes of storage.
If on the other hand you are looking to increase the speed of your drive, then the only way to do this is to replace the drive with a different technology such as an SSD or hybrid drive.
Before replacing your drive, first determine if your system has a user-serviceable drive. Some Macs such as the Mac Pro desktops and 15-inch and 13-inch unibody MacBook Pro systems have drives that are easy to access, but other Mac systems have the hard drive buried deep in the chassis and require delicate removal of parts to access them. You can look up the procedure for accessing your Mac's hard drive on sites like iFixIt, or Apple's Support Web page.
Another thing you will need before starting is to have your replacement drive available, and then you can use following procedure to clone your current OS installation to your new drive and then swap out the drives:
Attach new drive to computer: Get a USB or FireWire drive enclosure (e.g., the Murcury Elite or Mercury On-The-Go) that is compatible with your drive, or a drive adapter cable (such as the NewerTech Drive Adapter) that can attach to your new hard drive, and then use this to attach the drive to your computer. If you use an enclosure you can use it to turn your old drive into a handy external drive, but if you do not wish to do this then the cheaper option will be to use an adapter cable. Once the drive is attached to the system it will mount, and you can then use Disk Utility to partition and format it.
Do you have a Mac Pro? If your system has multiple drive bays and one bay is available, then you can use that bay to manage the new drive instead of using an enclosure or adapter cable.
As an optional step you can zero out data on the new drive using Disk Utility, which will help detect and replace bad blocks and ensure the entire surface of the drive is readable. Advanced drive maintenance tools like Drive Genius may have more in-depth routines for "breaking in" drives in this manner, but a simple zeroing out of the data should suffice for the most part. Keep in mind that if you are upgrading to an SSD drive then you should avoid zeroing out the data, as this can degrade performance especially in systems that do not support TRIM and other SSD garbage-collecting options (this will depend on the combination of the drive's firmware capabilities and the Mac you are using).
Clone system to new drive: With the new drive attached and mounted on your Mac, use a cloning utility to make a mirror copy of your old disk to the new one. Reputable cloning tools include Carbon Copy Cloner and SuperDuper, but if you cannot get these programs you can also use Disk Utility. In Disk Utility, select the old boot drive in the drive list and click the "Restore" tab. Then drag the destination volume (the new disk) to the "Destination" field and click "Restore."
Replace internal drive with cloned drive: Once the cloning procedure is done, unmount and disconnect the new drive from the system, and then shut down your system. Using the instructions for your Mac, open the system and replace the old drive with the new one.
If you have a system with multiple drive bays, then once cloning is finished you only need to shut the system down and remove the old drive, or you can just reboot the system to start using the new drive and format the old disk to use for other purposes.
Run general maintenance routine: After the system has booted successfully to the new drive, running a general maintenance routine on the system is a recommended step that will ensure all hardware settings, caches, and other temporary items are rebuilt fresh with the new hardware installed. In addition to running a maintenance routine, ensure the new drive is selected as your boot drive in the Startup Disk system preferences, which may prevent delays at start-up while the system searches for an available boot volume.
Overall this procedure will work on any system to upgrade or migrate a single volume. You can use it to upgrade storage drives, external drives, and even use it to migrate individual RAID volumes to a volume on a single disk or another RAID array.
For newer systems or those still covered by AppleCare, keep in mind that while this procedure will work, unless your system has a user-serviceable hard drive then you may void your AppleCare warranty by opening the computer chassis. Be sure to contact AppleCare to discuss your options before attempting to do this yourself.