How the Map works
The words "I solemnly swear that I am up to no good" transform the parchment into an enchanted map of Hogwarts, including all its secret passageways. It also reveals tiny labeled spots for every person in the area.
"Mischief managed" is the password for turning the parchment once more blank.
When an unauthorised person attempts to communicate with the Map, it is known to reply most impolitely, such as it did when Severus Snape tried to get it to reveal its secrets upon finding the suspicious parchment in the posession of Harry Potter. It appears that the four Marauders left a light imprint of their personalities in their creation--and they were, of course, all too willing to offend their old enemy, "Snivellus" (PA14).
The four Marauders created the Map after a few years of exploring the school grounds with the aid of James Potter's Invisibility Cloak. Given that it is signed with their nicknames, it was presumably made in their fifth year or later. (PA18)
The Map was confiscated by Argus Filch at some point in the boys' school years, and kept in a drawer in the caretaker's office. Filch certainly never figured out how to use the parchment.
Fred and George
Fred and George Weasley stole the Map from Filch's office, and effectively used it to create mayhem during their school years. When questioned as to how the twins figured out the correct password, JKR suggested that the Map itself gave them a hand.
The ragged parchment is their present to Harry, after the twins had memorised it well enough (PA10). It is soon confiscated by Remus (PA14), one of its creators, but he returns it to Harry shortly after he resigns (PA22).
The Map is taken early in the novel by Barty Crouch, Jr., who was impersonating Mad-Eye Moody, partially in order to keep his true identity a secret (GF25). Just before the school year's finish, however, Harry nicked the map from Moody's office (WBD).