Failed to verify InstallESD.dmg: hdiutil verify failed (Trying to reinstall Mac OS X Lion)
The pulling the RAM out before installing did the trick for me!

When I first bought my MacBook 5 years ago it only came with 4GB of RAM. About a year and a half ago I upgraded this to 8GB. For whatever reason this throws errors and won't let you reinstall Mac OS X again.

So what I did was turned the MacBook off and flipped it over and took off the bottom cover. I then removed one of the sticks of RAM (the one on top) and restarted the computer and tried installing again. This time it installed without any issues and after it was installed I put the other stick of RAM back in again.

Here's an article that will help you locate and remove any RAM that you may have previously installed in case someone else had done it for you or before you.

MacBook Pro: How to remove or install memory