Assuming that you can listen to a song and identify the riff, the best way to learn about riffs is just to listen to a catchy tune.
Many catchy riffs actually are multiple riffs in counterpoint. Then you have to figure out who's playing what. Two riffs are better than one (provided they go together)
When you hear something you like, ask yourself why you like it. If you can play it, then practice it. If there's something you don't like, ask yourself why it's wrong.
If you can't experiment with music by playing it in your head, use a piano. Pianos are usually easier than guitars.
(Actually if you can't listen to a song and identify the riff, you probably should not be writing music. Sorry but that's true.)
Offhand I can name these few artists who are good at riffs:
Beatles
Rolling Stones (obviously)
Clash (they are seriously underrated songwriters)
Parliament - Funkadelic
Sly + Family Stone
Chic
Kinks
Nirvana
Wire
James Brown
Television
Study, learn. Build up your vocab of riffs.