Record your own samples. Using samples that you record yourself is the best way to ensure that your commercial release doesn't violate any copyrights. When you create a sound, you automatically own the copyright for it; therefore, it's completely legal to incorporate these samples into a commercial release. Recording your own samples can, however, be tedious, and you're limited to recording sound sources to which you have access.
Use samples licensed under a Creative Commons license. Many sound designers and musicians release samples and music with a Creative Commons Attribution or Attribution-ShareAlike license. These licenses allow you to use the samples for any purpose, including on a commercial release. You must, however, credit the original artist on the release. If the sample or song has a ShareAlike license, you must also allow others to sample any release containing the sample.
Purchase and use royalty-free samples for your commercial release. After you pay the initial fee for a royalty-free sample, you can use it in any way you like. You may not, however, repackage and resell the samples on their own. Sound design companies such as Loopmasters, Prime Loops and Wave Alchemy offer collections of royalty-free samples on CD or in downloadble formats. Many established electronic music artists also release their own collections of royalty-free samples.