Peeves is the Hogwarts poltergeist. He is incredibly disrespectful: he sings songs to Harry about how crazy Harry is, he throws things at all of the teachers, and he generally brings chaos to the halls of Hogwarts. His one truly good trait is that he cannot stand control freak Professor Umbridge. So he does his best to make life for Professor Umbridge miserable by setting up pranks and being generally annoying.
In fact, when Fred and George make their spectacular exit from the castle, Peeves salutes them with genuine admiration from one prankster to another. Peeves agrees to give Professor Umbridge hell on behalf of the twins, and he is as good as his word. Peeves's anti-Umbridge campaign reaches its height as she is trying to slink out of the castle during dinnertime. Peeves sees her trying to leave quietly and seizes "his last chance to do as Fred had instructed, and chased her gleefully from the premises, whacking her alternately with a walking stick and a sock full of chalk" (38.104).