Casa de Campo is IMO a great park for riding and very close to the city centre. El Pardo is another (much bigger) park to the North of the city which is just reachable from the centre if you know the way (30 min ride away).
Or you can get the train to Cercedilla in the mountains further North (train takes about 50 minutes I think) and there is loads of riding up there. Equally there are trains out to places like Tres Cantos and Las Rozas which are just outside Madrid and while they don’t have the big mountains of La Sierra there are plenty of routes.
As for bike hire, your best bet would be to get a demo bike – probably from Karacol or maybe Mammoth.
Give me a shout when you’re coming and I should be able to show you round some of the routes.