Obviously, the best arrangement is for the person who writes the songs to have it clearly stated that they wrote the songs. Consult an attorney with specific knowledge about intellectual property. You need to get a clear agreement as to who owns what.
You must contact the song’s publisher or publishers to get permission to sample a song. Publisher information can usually be found in the Performing Rights Organization websites. You’ll likely have to search within the PRO with which the song is registered.
Be smart, do your homework! Take advantage of the resources that are available to you, such as organizations like TAXI or Circle of Songs. There are great classes and seminars offered by organizations like BMI that can further help you develop your songwriting skills. In addition there are several trade magazines, such as Performing Songwriter, that offer valuable information for the beginning songwriter.