There are quite a few good, cheap neigborhoods to get a place. Regarding safety, Madrid is a very safe city compared to those in the states. Petty theft/pickpocketting is the only thing most people need to worry about. I've lived in several areas of the city in the past. Looking for student areas, you'll probably want to check out Moncloa and the neighboring districts of Arguelles and Chamberi. I live in Chamberi before and it is a nice combination of student life and a more mature crowd. Also, I lived in the Malasana district, which is near Metro Tribunal. This area is known for it's crazy student night life and a large gay/lesbian crowd. My wife and I lived there for about 6 months during temprary work assignments. I've had good experiences with all of the areas mentioned above.