2 people => 1 handshake (AB)
3 people => 3 handshakes (AB, BC, AC)
4 people => 6 handshakes (AB, AC, AD, BC, BD, CD)
Do you see a pattern here?
We can write a general formula for this
Since we are given that there were 15 handshakes
This means that n = 6 people were present at the party.
You can substitute n = 6 into the above formula and you will notice that it will give 15 handshakes