I'm not sure why or how middle names originated, alas, but others around here probably are. There are a few modern purposes . . . one, it's often hard for two people to agree on a single name, and having two gives more flexibility. Middle names also protect prospective parents from having to give their child a really horrible name if they want to honor the people who bears it; just give it as a middle name and call the baby something nice. :) I've seen a lot of middle names that are the mother's surname or the name of a friend or relative of the parents [not all necessarily because the name was ugly, though...]. And with names, complicated is better—if names' meanings weren't so complicated to find, this beautiful website would not exist! Heh, I'm mostly kidding.
I'm not sure about which reason is the main one for your last question, but some parents might choose two names for their child and decide they sound better with the favorite name second—if they want to call the kid
Denise, and want to use
Lia as well, they might name the child
Lia Denise and call her
Denise if they think
Denise Lia sounds horrid. I'm not sure about people choosing their middle names over their first; I tried it once [in fifth grade] but it never stuck. Hard. :\
The main reason I like middle names is because it's an excuse to use up more of my favorites. ;D And this was really long for so little actual content, I guess I'm not in a very conciseish mood tonight.