DD's has 2 middle names - her first middle name is Claudia after DP's father Barry Claude and his grandfather Claude who are no longer with us (and we really couldn't inflict Claude onto a boy so Claudia was a nice option). Her second is my surname.

This time if we have a boy trhe middle name will be David or John after my father plus my surname. I'm not sure what we will do if we have a girl.

I never thought about why but because DP and I both have middle names we just automatically slected middle names for out children. A PP made a good point though - with so many people in the world it is likely that someone else will have the same first name and surname combination but it is less likely that they will have the same middle name as well so it does make them more identifiable.