Choose several notes from a chord or scale. A guitar riff can be literally any small grouping of notes, and most riffs are often based on single notes rather than chords.
Play the chosen notes in different orders and rhythmic patterns until you hear something pleasing to you. Feel free to experiment, decide what pattern feels good and creates the sound and mood you want to communicate to your listeners.
Practice the pattern as much as possible to build confidence. Try playing along with a practice rhythm track CD. These are available at most music supply stores and are a great way to create and practice new ideas.