A (headphone) amp is an electronic device that takes in two analog input signals (voltages) and outputs two analog signals (voltages), with the electrical performance characteristics to send those to headphones. There's more or less one signal for L channel and one for R channel. Traditionally you would expect the output of the device to follow the input as closely as possible, so they look the same. (Some devices tinker with the input, intentionally or not.) Every device with a headphone jack has a headphone amp integrated. A lot of times when people say "headphone amp" they're talking about a dedicated external device though.
Generally most amplifiers can make the signals louder (also softer), hence amplify them so your headphones sound louder. If you increase the level your headphones get, they will be louder. If you get more sensitive headphones, they will also be louder. A lot of times, a more powerful headphone amplifier capable of outputting a higher voltage or current may not be necessary for more sensitive headphones.
Depending on the electrical circuit of the amplifier and the headphones they are connected to, they can have different performance characteristics. In other words, the output of the device may deviate from the input that was given. If the output deviates less from the input, then we say that the amplifier has higher fidelity. These are analog systems, so of course we can't do anything with 100% accuracy; however, we can get so close that you (or anyone else) can't tell the difference. Hence a better amplifier could improve the overall fidelity of the system. Getting better headphones will also do this, potentially by more.
In general the headphones make a lot more difference in the sound quality, so just get the headphones you like and then get an amp that's suitable for driving them. Many times the integrated amp of whatever you are using should be sufficient. Something more expensive may be a little better, but different and more expensive headphones would have also been better too.
A decent "reference" low-cost amp is like a FiiO E5 for $20. You can use it to see if the headphone out of whatever you are using is really bad or not. If the E5 sounds significantly different, it integrated amp was no good for your headphones. I wouldn't necessarily expect that for ATH-M50 though, as they're not particularly problematic to drive.