Dissonance, resolution, and suspense can be used to create musical interest. Where a melody or chordal pattern is expected to resolve to a certain note or chord, a different but similarly suitable note can be resolved to instead, creating an interesting and unexpected sound. For example, the deceptive cadence.
^Benjamin, Horvit, and Nelson (2008). Techniques and Materials of Music, p.46. ISBN0-495-50054-2.