Well that is a big question as others have stated.
It starts first with the recording and recording process. From quality of microphones, to placement , to room acoustics. Then its the recording, if its analog tape then the higher the tape speed the higher resolution you get. 15ips (15 inches per second) is generally the highest quality. If its digital then sample rate, 96khz 24 bit is generally the highest consumer playback which is SACD, requires a SACD cd and player.
Standard cd's are 44.1 khz 16bit so SACD is double the sample and bit rate giving much more resolution and detail.
MP3 124kps or 320kps is very low resolution and honestly very low end sound. Most people don't know that you can burn music on to your ipods at cd quality 44.khz 16 bit, but yes it takes up much more room. So you get approximately 8 times more songs on your ipod using MP3 over buring at cd quality.
Then it comes to the playback system
Speakers, amps, cd players, Turntables, Phonostages, Phono cartridges, cables, all have different levels of performance. As the equipment gets better, better parts, better technology, sound quality gets better. In most cases as equipment gets more expensive the equipment get better.
System setup and calibration are essential to get good sound. All the great equipment, recordings will not come through if the system is not properly setup.
Its virtually endless how far you can take sound quality, but it all comes back to how good the recording is.
A good book you might want to consider reading is the Guide to Hi-End Audio, by Robert Harley, as it explains all the things that make sound good and how to buy and setup a high quality music system.
Kevin
35 years hi-end audio video specialist