I see that you only registered today on this site, and though I feel there are much better people on this bulletin board to welcome you, especially the Madridman, I welcome you to this bulletin board. I lived in Madrid from 1977 until 1980 and have been back there three times, 1994, 1998 and last October 2002. Madrid will be able to provide all of the criteria you've posted.
First of all, you will find on the Madridman's website, many Hostels and many reviews of Hostels. These are small family run hotels that generally cost about $40, 35-40 Euros. A hostel is generally a small room in a big building. I find them comfortable enough for the few hours I spend in a hotel room while visiting Madrid.
Anywhere in Madrid you can get a good meal and go out partying until the wee hours stumbling from Bar-Cerveceria to Bar-Cerveceria. But I suppose the best areas are around Puerto del Sol and/or Gran Via which are close to each other.
A word of caution though. During my last visit, last October, I found Madrid changing quite a bit. Scam artist and pickpockets saturate Madrid. There's still a good chance that you will not be a victim, but heads up.
I really hope you enjoy your first trip to Madrid.
"I swear -by my life and my love of it -that I will never live for the sake of another man, nor ask another man to live for mine."