Transport is brilliant.
Metro runs ~5am-1am; there are also night buses
3 day pass for 18eu which is not too bad.
24eu for a month's pass if <25yo
*Central Madrid (Gran Via-Plaza de Espana-Opera-PrincipePio-Callao-Sol-Atocha/Atocha Renfe) is very very very walkable, so I'd suggest you go google-map and star everything first then plan accordingly by location!
Sightseeing (Mostly within walkable distance from Sol)
Royal palace of Madrid
Plaza Mayor, Puerta del Sol, 0km mark - large public squares with restaurants and things around
Plaza de Cibeles
Almudena Cathedral
Temple of Debod - Egyptian temple, in a parkland area to picnic at and see view of Madrid; nice at sunset
Parque de Buen Retiro - large park with a boating lake, statues, rose garden, 'glass palace' etc; book fairs on Sun; nice to run in.
Parque de El Capricho - smaller, much further, only takes in a certain amount of visitors a day, but landscaped
Circulo de Belles Artes: views of Madrid, rooftop restaurant
The Literary Quarter - street with quotes by Spanish literary figures eg Cervantes
Museums
Museo Nacional Del Prado: famous works by Velazquez, Goya etc.
Museo de Reina Sofia: more modern; has Picasso and Dali
Thyssen-Bornemisza Museum: 1000+ paintings chronologically
Sorolla Museum: preserved house of Sorolla, with his paintings
Also others eg archaelogical, naval museums.
*google timings, as there is free entry to most palces at certain times (eg 6-8pm on certain days)
Other activities
Sol-Gran Via are the shopping areas.
El Rastro market is a flea market; KEEP YOUR BELONGINGS SAFE
Theaters (Teatro Real) are 90% off for students - can buy same day tix if got anything interesting.
Night life's very vibrant: Many clubs/bars near Sol - around ?Calle del Príncipe; Largest is Kapital (7 storeys with diff themes, and free on Thursdays before 11pm (or after 11pm cant rmb pls check))
Food (lunch 2-3pm, dinner 9-11pm!!)
Tapas: 100 Montaditos (pronounced as cien montaditos) from 1eu; others are good too; De Patatas Madre has a potato form (v filling)
Churros: San Gines is classic hahaha - the default is milk chocolate but can try asking for other types.
Sangria: a good wine-ish one is at Las Cuevas de Sesamo (but KIV that it's underground/looks vaguely shady and has no phone/internet reception HAHA BUT IZ GOOD). 100 Montaditos has a fizzy version. Cheap version: vino tinto
Menu del dias (two main courses, bread, wine/water and dessert for a fixed price eg 10eu for lunch: any random restaurants
San Miguel Market: hipster tourist food
Mercado de la Cebada: wet market with seafood++, cherries+++ and also food and wine, and an amazing 5eu burger (can't rmb name but it's on the first floor, looks v unassuming.)
Lizzaran: typical spanish food/tapas at reasonale prices
Goiko Grill: burger chain
Don't bother getting the calamari sandwich - it's not bad, but it's a very touristy food that the locals never eat.
Outside Madrid (1-2h by train/bus):
Segovia: castle that inspired Sleeping Beauty's, Roman aqueduct
Toledo: medieval town; Jewish monastery, castle, old museums, bridges (Note: very hilly)
San Lorenzo de El Escorial: Renaissance palace, war monument, hiking with good views
Araquez: palace, large park (KIV: 40min walk from train station)
Alcala de Henares: where Cervantes lived