Q:

Hard drive died, how do I get the OS X on new hard drive?

I have a huge problem. My hard disk seems to be dead. I did a lot of things but I guess it's really gone. The thing is that I don't have CDs o DVDs of the OS X Lion (it's a macbook pro A1278 bought in 2012) and no backup in time machine. I lost all my files so I'm already grieving. 
The thing is, if I buy a new HDD, how do I get the OS X there?

A:

Buy an SSD instead of an HDD if you can afford one. Believe me, you'll thank us. You currently have a MacBook Pro with a fast Intel processor but an extraordinarily slow hard drive. Your failed hard drive was your computer's main performance bottleneck. Replace it with a fast SSD from a reputable manufacturer like Samsung or Intel, and your computer will perform far better than new.
You could reinstall Lion using Internet Recovery. But, it would be much better to skip the outdated versions and install Yosemite. You can create a bootable Yosemite installation disk using an 8GB USB flash drive and a friend's Mac. Here are Apple's instructions for creating a bootable Yosemite install disk from an 8GB USB flash drive:

Download the OS X Installer app from the Mac App Store.
Mount the volume you want to convert into a bootable installer. This could be 
  removable media such as a USB flash drive, or a secondary internal partition.
You can then use the createinstallmedia tool to convert the volume from step 
  two into a bootable installer based off the installer app from step one. To learn how to use createinstallmedia, use the following command in Terminal:
/Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia

After you have created a Yosemite installation disk, insert it in your Mac's USB port and hold down Option as you power up. You will be able to boot from your Yosemite installation disk, just like you would from a Lion installation DVD.

Non-technical users may prefer a more detailed walkthrough of creating a Yosemite installation disc.

A:

You may be able to do Internet Recovery by pressing Cmd+R during startup. If that is possible, then:

Install the new HDD.
Boot to Internet Recovery.
Enter Disk Utility.
Create the installation partition.
Exit Disk Utility and choose to Reinstall Mac OS X.

You can test this even with the bad HDD still in place.
If your system did not come from Apple with installation DVDs, your system most likely supports Internet Recovery. You'll need an internet connection for it to work and, yep, it'll take some time to download that Lion image.

