How do I get an operating system onto a new hard drive? I will be installing a new 500GB hard drive in my macbook.  It is a late 2008, aluminum, 13-inch screen.  Once I install it, how do I get an operating system that's 10.7 or newer (downloaded from the App Store) on to the bare/unformatted drive?
Being a 1 Mac household and an IT professional who has only supported PCs, I had a challenging time trying to figure out how to reload OSX after my husband's Mac hard drive died. Hopefully I diagnosed a bad hard drive correctly (I'll provide my method) and I hope this helps someone out there. This is probably overkill on instructions, but there are PC people out there who may try to help out the  (much more) rare critical Mac issue. I did most of this from memory, so I may have messed up a label here or there. Please use Common sense if I did this and look around the screen for something that looks like what I'm talking about.
NOTE: This process only worked because the hard drive was still able to access recovery mode by holding Command+R on startup. If your Mac is unable to access that feature, this may not work for you, but I included some other handy stuff, like recovering files from the drive.
Initial Symptom: My husband's Mac had been randomly shutting down for some time, but we were limping it along. Finally, on startup one day, he saw a progress bar that would complete and then the device would shut down. Here is the process I followed:
Things you'll need:

SATA/IDE to USB Adapter (Mine was Vantec USB 2.0, but it shouldn't matter. Be sure to get one with external power source. I've had little to no success with USB powered devices.
Mac running OSX Lion or later (prior versions didn't have the recovery partition)
New Hard drive that is compatible with Mac.
T8 Mini Torx screw driver
Small phillips screwdriver
Recommend: A cold beer and a lot of patience
Just in case you pull off the rubber coating, you'll need a case removal tool like you use to replace a cell phone screen. http://www.amazon.com/dp/B004XVPDSG/ref=tsm_1_fb_lk

Step 1: Troubleshoot the Device

Power off the Device
Hold down the Command+R keys as you start the device. Continue holding the keys until the Recovery Utility prompts you to select a language (Grey Screen) **NOTE:**You may have to hold the keys for up to two minutes.
After you've selected a language preference, Select the Disk Utility item in the list of utilities.
Select your drive on the left navigation panel (It's probably already selected)
Click the Verify Disk button in the Disk Utilities. It will probably show some erros. Click the Repair Disk button that will only appear after you click Verify. Do this until there are no errors or (like me) you receive a message saying that the disc couldn't be repaired.
Click the Verify Disk Permissions button. If this completes successfully, click Repair Disk Permissions
NOTE This may solve your problem. If you didn't receive a nasty message on step 5 saying the Disk was corrupt, to back up your files and such, good on ya! Try some Canadian troubleshooting -- When in doot (doubt) Reboot!

Step 2: Removing the Hard Drive from the Mac
Here's a great visual guide to the steps below: https://www.ifixit.com/Guide/MacBook+Pro+13-Inch+Unibody+Mid+2010+Hard+Drive+Replacement/4305

Turn off the MacBook.
Remove the hard drive from the device by removing the 8 screws from the bottom of the MacBook and pulling off the bottom cover, being careful not to pull at the edges as it will pull off the rubber coating. If you accidentally do this, tip to follow. To pull the cover, put your fingers at the hinge of the MacBook screen (from the bottom), and lift from the metal part under the rubber cover.
You will see a small black bar held down with two screws right next to the hard drive. This must be removed before the hard drive is pulled out.
If your hard drive is OEM, there should be a plastic tab that you gently pull on to lift the hard drive, being cautious of the SATA cable
Pull gently at the cable connector seated in the end of the hard drive facing the exterior of the case to disconnect the hard drive.

If you messed up and pulled off the rubber coating:

After you have finished removing the bottom cover, get out the case removal tool from the list of things you'll need that you diligently ordered with your new hard drive for just $1 or so
Hold the rubber coating on the metal case with the metal part (inside of the cover) facing you.
GENTLY slip the edge of the case removal tool under the edges of the rubber coating with the edge of the tool facing towards you and lift the edge back over the edge of the metal backing.
Slowly glide the tool around the edge, lifting the rubber back into place, being extra cautious around the corners.
Put the back plate down and don't breathe on it or the rubber stuff will come off again.

Step 3: Using a PC and HFS Explorer to Recover Files

Download HFS Explorer and install it on your PC (http://www.catacombae.org/hfsexplorer/)
Plug the removed hard drive into the SATA/IDE to USB device. There will be two cables to plug in and they are directional. The smaller plug is the data cable that goes into the rectangular USB connector. The other goes to the power cable. If you bought the same one I did, there is a connector that adapts the standard power supply connector to SATA. There is a power switch on this cable.
Plug the USB cable into your PC and turn on the power switch on the cable (if you haven't already).
You should hear the device chime in Windows, or you can verify that the device driver was recognized and installed in Device Manager. Note: You will not see it show up as a hard drive as the Mac drive format is not diurectly compatible as a disk drive with Windows.
Open HFS Explorer and click File &gt; Load File System From Device
I was not able to use the AutoDetect Button successfully, but you can try. I selected the Select a Device radio button and in the Detected Devices drop-down and click Load
Select the files and folders you wish to back up in the tree to the left just like you would any Explorer (or Finder for you Mac peeps) tree, then click Extract. My husband's files were in the second partition under the Users &gt; [Username] folder.
Follow the prompts to extract the files to the desired location. You will have to babysit it because there are a lot of Mac file names that are not OK on Windows. I used the &quot;Auto-Rename&quot; feature and it worked swimmingly.

Step 4: Installing OSX on the New Hard Drive
If you're still with me, crack open another beer, because you've probably finished the first one. This was the most frustrating part to research. When you Google, &quot; How do I load OSX on a new hard drive using a PC &quot;, you end up with some great suggestions to use VM Virtual Box, which means you have to get a copy of your OSX load. Well, mine happened to be on this one very broken Mac hard drive, and you can only make a Mac bootable with a Mac. Grr...So, I gave this a shot. I hope it works for you.

Install the NEW hard drive back into Mac. Before you do this, there are a couple of screw-in pins that are in the sides of the old hard drive that you will need to hold your new hard drive in place. Use the T8 mini Torx screwdriver to remove them and place them into the sides of the new drive. These will hold your new drive in place. Put a couple of screws on opposite corners of the bottom plate to hold it in place and protect all the precious bits in there. Do not turn on the Mac yet
Connect the OLD device to the SATA/IDE connector, connect the USB to the Mac and turn on the power to the new hard drive
Hold down the Option key and turn on the device to choose which device to boot to.
Select the OLD hard drive (Probably called Recovery_[something]) when prompted to choose a boot device.
The boot sequence will take you into the Mac Recovery Utilities menu
Select the Disk Utilities option from the menu
Select the NEW Drive in the list to the left and click Verify Disk. This should come out clean
Click the Erase option in the Disk Utility and complete a format of the hard drive using the Mac OS Extended (Journaled) option
If you like, partition the drive using the Partition option and set the number and size of partitions to the desired size.
Exit the Disk Utility tools using the menu in the upper-left
In the recovery menu, click the Reinstall OSX option
If you are prompted to connect to a wireless network, you can either connect it to an ethernet cable to speed things along, or click the Wireless icon in the upper-right of the top toolbar to search for an SSID to connect to. This will permit you to use the online recovery options to download the operating system.
Follow the prompts and enter your iTunes login info
When prompted to select a disk for installation, select the disk (or partition) you would like to install OSX on on the NEW hard drive and follow the prompts to initiate the installation.
IMPORTANT When the reboot after download occurs, if the installation gets stuck on Verifying Disks or shows symptoms of pixelation on the progress bar and corresponding status text, hold down the power button on the Mac to shut it down. CONGRATULATIONS! You successfully diagnosed that the old hard drive is bad. ;-) If this occurs and your installation doesn't go through, pull the USB cable from the SATA/IDE to USB adapter from the USB port, hold down the Control key and turn the Mac on. Select the Install OS X drive as the boot device.
Wait for an eternity...have a couple more beers...Voila.