These three words mean the same thing. 'Ostinato' is more often used when describing classical music. 'Riff' is more often used when describing pop music and 'loop' is used in contemporary dance music.
A riff, ostinato or loop is a repeated pattern of notes.
Here is an example of an ostinato from Carl Orff's 'Carmina Burana'. The ostinato is played on the bass instruments.
Here is an example of a riff from a 1970s disco track. You can hear the riff played on the guitar.
Finally, here is a loop from a techno track. Looping is where a short sample is repeated over and over again. Here, you can hear loops on the drums and the synthesised xylophone sound.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.