The job of a headphone amplifier is to "amplify" the normally weak audio signal produced by the source — which in a desktop audio setup, is a laptop of computer — into one that the headphone's drivers get more out of. Without an amp or a DAC, the headphones wouldn't be able to play your computer's audio.
(The digital-to-analog converter, or DAC, is the other vital component that's usually built into most headphone amps. It converts the digital signal sent from the computer into an analog signal that the headphone amp can actually use. A DAC is only necessary when you have a digital source like a computer or smartphone, as opposed to an analog source like a turntable or CD player.)
However, the headphone amp is just one link in the audio chain and according to Dave Evans, the co-founder of Audioengine, a high-quality amp isn't going to be able to improve cheap earphones. "You can only improve to the limits of the weakest link in the chain," Evans explained "If the headphones (or earbuds) have more to give, [a headphone] amp will 'let them' give it. But if there’s no more to give, there’s no more to be had."
If you have a nicer pair of headphones whose been plugging it into your laptop or computer, that's a different story. Your laptop or desktop already has a built-in headphone amp/DAC, of course, otherwise your headphones wouldn't work with it — but it's not every good. "Most built-in amp/DAC combos are inferior simply because of space and cost constraints," says Evans. "[It's] not always [the case], but it’s a good rule of thumb."
The great thing is that if you're looking for an external headphones amp to upgrade your desktop audio setup, there are a lot of relatively affordable options. There's the Schiit Audio Magni ($99), Audioengine D1 ($169) or Audioengine N22 ($199), all of which are great headphones amp that cost under $200.
If you’re going to invest in a higher-quality headphone amp to replace the one built into your smartphone or computer, then you’d better wise up and invest in some higher-end headphones or IEMs, as well.