Comping (an abbreviation of accompanying; or possibly from the verb, to "complement") is the chords, rhythms, and countermelodies that keyboard players (piano or organ), guitar players, or drummers use to support a jazz musician's improvised solo or melody lines. It is also the action of accompanying, and the left-hand part of a solo pianist.
The term comping is also an abbreviation of compiling, whereby the best sections of several takes are "comped" into one track. 
The chordal accompaniment used in jazz is different from the chordal accompaniment style used in many types of popular music, such as rock and folk.
In combos with a guitar player, the guitar player usually comps for soloists. If there is both a pianist and a guitarist, as sometimes occurs in organ trios or big bands, they may either alternate comping or comp at the same time. Having two chordal instruments comp at the same time is difficult to do well. The two compers may make different, clashing interpretations of the same chord (e.g., the pianist may add a flat 13th, while the guitarist plays a natural 13th), or the texture may become overly cluttered. This may also result in a fight between the pianist and guitarist. One solution is for the two comping instrumentalists to play sparsely.
Comping is almost always improvised by the comping musicians based on a chord chart, lead sheet (which contains the chords written above the melody), sheet music, or, in country music, the Nashville number system. The exception is well-known progressions (e.g., 12 bar blues) and jazz standards such as "I've Got Rhythm", known colloquially as "Rhythm Changes". For well-known progressions, the bandleader may simply say "solos on blues changes" or "solos on Rhythm Changes", and the comping musicians are expected to be familiar with these chord progressions. Top soloists playing with the most advanced comping musicians may simply call out the name of jazz standards, and the sidemen will be expected to know the chord progression. For example, the soloist may request "Autumn Leaves" without providing the compers with a chord chart or sheet music. The compers at the highest professional level would be expected to know this tune.
Since there are many variant versions of these chord progressions, the comping musicians will have to come to an unspoken consensus on which chords to use. For example, there are many different turnarounds used for the last two bars of a 12 bar blues; however, if the bandleader, playing Hammond organ, plays I/VI7/ii7/V7 for the turnaround, most skilled compers will hear these chords by ear and then replicate them in subsequent choruses (each full playing of the 12-bar progression is colloquially called a "chorus").
During swing-feel songs, drummers will usually comp with one hand on the snare drum while playing time on the cymbals, typically on the ride cymbal (see drum kit). More skilled drummers often comp with even all three limbs excluding their right-hand ride pattern (snare drum, bass drum, hi-hats). They will most likely develop the simple jazz drum pattern and add a few "bomb" bass drum notes for extra effect.
In small jazz ensembles ("combos") with more unusual instrumentation, horn players (e.g., saxophone, trumpet, etc.) can comp by playing the melody line in the background, or by playing a sequence of notes called "guide tones" which outline the harmonic framework. Guide tones are usually the 3rd, 7th, or 9th notes of a given chord. Guide tone lines are constructed by descending (or ascending) through the guide tones of the chart, normally by semitone or tone. For instance, in a duo for saxophone and bass, the saxophonist might comp during the bass solo by playing guide tones.
For example, during the standard jazz chord progression ii7/V7/I/VI7 (in the key of C Major, this would be d minor 7/G7/C/A7), a horn player might play the guide tones, in whole notes, C (minor 7th of d minor), B (third of G7), A (sixth of C; sixths are added to major chords and dominant seventh chords in jazz even when not specified) and G (minor 7th of A7). This is only one possible guide tone sequence. A second guide tone sequence (in whole notes) might be F (minor third of d minor), E (sixth of G7), D (ninth of C Major; as with sixths, ninths are often added to chord voicings even when not indicated), C# (major third of A7).
During a drum solo, the entire band may tacet (called "laying out" in jazz slang). Alternatively, the pianist (and possibly the bassist and/or guitarist or organist) sometimes comps, often using a predictable pattern of rhythmically played chords called "hits". A well-known example is the second half of "Take Five", with Dave Brubeck's piano vamp comping for Joe Morello's drum solo. During piano solos, pianists often comp for themselves, playing melodic lines and solos with the right hand while comping with the left hand.
While any jazz instrument can be used for comping, the chordal rhythm section instruments (piano, organ, and guitar) have developed the largest collection of pedagogical materials about comping. Since a jazz soloist has such wide-ranging harmonic, melodic, and rhythmic possibilities, chordal instrumentalists must have a similarly wide range of tools at their disposal to support the soloist properly.
Comping musicians must know many different types of chord voicings so that they can match the mood the soloist is trying to create. To support some soloists, a comper needs to use very simple voicings (such as the 3rd and 7th of a chord). However, for other soloists who play in a very dense, complicated style, compers may need to use chords with many additional extensions, such as 9ths, 13ths, and altered voicings; they may also re-harmonize chord progressions depending on the soloist, thus creating a feedback of idea exchange between the soloist and the comper. For the most sophisticated soloists, a comper may need to be able to respond in real time to newly improvised implied chord changes.
Compers must have an understanding of rhythm that allows them to respond to the rhythms and beat patterns the soloist plays, such as Latin or Afro-Cuban rhythms. As well, they must have a melodic sense based on a knowledge of a huge repertoire of different scales and scalar patterns, to be able to improvise countermelodies to supplement the soloist's melodies and fill in empty spaces.
By comping, pianists, organists, and guitarists provide the "glue" that holds the rhythm section together. They take the soloist's improvised solos and melodies and add harmonies (as a bass player does) and rhythms (as a drummer does). By doing this, the comper helps ensure that the band is always at the same energy level as the soloist. Wynton Kelly and Herbie Hancock are examples of pianists who are responsive when comping. Oscar Peterson usually comped busily, while Count Basie comped sparsely. There is no single appropriate way to comp for a soloist.
A comper adapts his or her style to that of the soloist. In a jazz band with multiple soloists, this may require different styles for different soloists. For example, the saxophone player in a band may imply many extensions and altered chords in his soloing (e.g., b9, b13, etc.). For this soloist, a comper may decide to play altered dominants and dense harmonies. The next soloist, a jazz guitarist, may play sparse, delicate melody lines, with lots of space. For this soloist, the comper may use open voicings, omit passing chords, and try to play mainly in the space left by the soloist. If a soloist starts implying a certain style or feel in his solo, whether this is Afro-Cuban music or hard-driving swing, the entire rhythm section may shift to this style to support him.
In a tune, if a soloist starts playing in a jazz-rock fusion style, the comping musicians may adapt and shift into a rock-influenced groove. A guitarist who is comping may turn on an overdrive pedal to add rock music-style "growl" to his tone. A guitarist may also use other effects units, such as a chorus effect. A keyboardist playing Fender Rhodes electric piano or Hammond organ may turn up his preamplifier to produce a natural tube overdrive tone for his sound. A drummer may shift to a rock style of drumming.
In all but the largest big bands, the comping sidemen in a jazz show are often called upon by the bandleader to improvise a solo. Here, the comper takes centre stage and performs an improvised melody line. For 1920s Dixieland and some Swing era jazz, the comper may embellish the melody line and improvise by ear during his solo. For Bebop-style groups, the comper playing a solo will often base his improvisations on the chord progression of the song. Bebop tunes often have one, two or even three chord changes per bar and some tunes change keys every few bars; as such, it is hard to solo "by ear" on a Bebop song.