The major "building block" in accompaniment is chords. And the sequence of chords.

At the listed web sites you can find chord tables and theory, pattern samples, software for drum/beat, and some software programs for chord detection.