Well there are two ways to do this.
You either use a 3rd party library from people who know what they are doing and have already done all the hard work for you, like fmod (www.fmod.org) which is really fast (in terms of setting it up and getting results), easy and powerful, or if you want to do it yourself, you need to basically fill an array of samples (a buffer) manually and send it to the sound card using the platform specific API, for Windows one option would be DirectSound.
I don't know if there is anything besides DirectSound since It's the only thing I have ever used.
If you want to do it manually with for example DirectSound and you want to play MP3s you also have to read in the MP3 file yourself, then decompress it and convert it to an array of samples, which can be anything from a byte to 4 byte, depending on sampling depth, then send it to the sound card.
I don't remember ALL the details, but since it's all very much a pain in the ass I suggest you just go with a 3rd party library unless you need more control if you're programming a synthesizer or something ;)
If you still want to try coding it yourself instead, you can either look it up on MSDN or maybe look for a video on YouTube.
But it may be intimidating for beginners.
https://msdn.microsoft.com/en-us/library/windows/desktop/bb318665%28v=vs.85%29.aspx
Here is a video that explains part of it, but It's kind of in the middle of a series and may not be suited for beginners:
https://youtu.be/qGC3xiliJW8?t=16m37s
If you don't use Windows, well, you will have to look for something else because DirectSound is Windows only :)
I highly recommed fmod though. That should also be multi-platform I think.