Many online services offer legal music downloads and streaming. Some online storefronts also offer free music, either as part of a rotating selection or from artists always offering free music.
Only use legal download services to obtain digital music. Illegally obtaining music is piracy.
Free Offerings from Paid Storefronts
Frequently check your favorite online music stores for free music. Amazon offers many free songs and titles, as does the iTunes Store and Bandcamp. Online stores that offer freebies generally have a section dedicated specifically to free songs, or offer a rotation of free tracks as special offers.
Online Music Hosting
Online music hosting sites like SoundCloud make it possible for artists to offer their songs to fans for free, either as downloads or as on-site audio streams. Check with the site's FAQ before trying to download anything, to make sure that it's actually allowed. Bear in mind that hosting sites usually leave the download option -- or how much a download costs -- to the artist's discretion.
Free Download Sites
Many online services legally offer free music for download. How the site offers the music varies: in some cases, the site is supported by ads, while in others, you may need to complete a special offer. In some cases, the music is offered directly by artists to help get exposure. Some examples include Jamendo, Free Music Archive, Sound Owl, QTRAX, and NoiseTrade. Many sites also offer streaming services and have libraries with a wide variety of music.
Free Streaming Music Services
If you don't need to keep copies of songs on your computer or you want an experience more like listening to the radio, online streaming services are solid alternatives to downloads. Services like Spotify, Pandora and Last.FM, all offer free online streams, which can often be customized by genre, artist or song. Some also offer free downloads for offline listening.
Direct from the Artist
In some cases, your favorite artists may offer some tracks for free on their websites. When or if an artist gives away music is clearly up to their discretion, but it's worth checking periodically to see if any songs are available for free as a promotion. In some cases, artists may also give away promotional downloads on social media like Facebook and Twitter, so keeping up with their accounts may be also be a good idea.