The technique is called imitation. It is a compositional device where a musical phrase or idea is repeated in a different voice or instrument, usually immediately following the original statement. Imitation creates unity and coherence in a composition while adding variety and interest. It is a hallmark of canons and fugues but appears across many musical genres.