Pen Names. How do they work, and who decides them--you, the publisher, the agent?
The short answer is: All of the above.
How they work is this: That's the name printed on the front of the book under the word "by."
As to why you might want one:
1) You're writing a series book. The publisher owns the name, and that's the name on all the books in that series. Examples include the Tom Swift novels by Victor Appleton, Hardy Boys books by Franklin W. Dixon, and Nancy Drew books by Carolyn Keene.
2) It simplifies things. When a pair of authors work together, they may have a pseudonym for their joint effort. For example, when Henry Kuttner and C. L. Moore wrote together, they published their novels under the name Lewis Padgett.
3) Your name might be confused with some other author's. If your name was Joanne K. Rowling or Stephen King or Dan Brown, your publisher would probably want you to write under a pseudonym.
4) The author may be very prolific, and may not want to go into competition with himself. Say there's an author who writes six novels a year. He may put those out under three different names, so that someone in the bookstore may say, "Wow! A new Charles Collingwood, a new Frederick Fane, and a new Rosa Belinda Coote! I like 'em all! I'll buy 'em all!" rather than saying, "Hmmm... three books by Charles Collingwood. I'll get this one."
5) The author may hate his name. For example, Sherwood Smith's name isn't Sherwood
or Smith, but she really loathes the name that's on her driver's license.
6) Genre conventions dictate a particular kind of name on the jacket. Men's action/adventure novels usually have male names on 'em, romances usually have female names on 'em, regardless of the plumbing of the author.
7) The author may want to keep the various genres she writes separate, so that fans of her gritty urban procedurals won't be confused by picking up one of her cozy mysteries. Just as the number one reason someone reads a novel is they read and enjoyed a previous work, if they read and hated a previous work they won't pick up the next one by that same author.
8) The author may not want family/friends/church to know that he's writing steamy bodice-rippers (with a side-order of bodily fluids). Or an academic may not want the tenure committee to know that she's writing charming YA fantasies, lest they think she "isn't serious about academia."
9) The author may be caught in the order-to-net Death Spiral, where the only way out is to change the byline. (This is sometimes referred to as the "DAW Witness Protection Program.")
10) Or, maybe, the ever-popular Other.