Free Use with songs on a site?

What is the policy concerning use of songs on a website? In my previous web design class it was taught that you could use 10% of a song or up to 30 seconds, but I have seen numerous sites with several (5+) songs in a mini-playlist on their site. Do you have to purchase some sort of rights to this song, or will written consent from the artists do? Does it have anything to do with whether the songs are going to be displayed on a commercial, amateur, or non-profit organization page?