The first of the 7 people will shake hands with 6 others. Only 6 because no person is going to shake hands with themselves. The second person also shakes hands with 6 people, but you have already counted one of those handshakes, namely the one with the first person. Therefore, the second person shakes hands with only 5 NEW people. Then the third person adds 4 new handshakes, etc., down to the 2nd to the last person who adds 1 new handshake. The last person has no one new, so all of the last person's handshakes are already counted. In summary:

6+5+4+3+2+1=21