You and your kids are going to have a great time in Madrid.
It is such a friendly city. I was in Madrid with my kids two summers ago and they really enjoyed the MadridVision tour bus around the city, the Reina Sofía to see Picasso and Miró's works, The Royal Palace, Casa Botín restaurante ( reserve a table downstairs in the bodega and go late)...the Tuna singing mistrels come by ...it is so much fun.
As for a sidetrip: my kids liked Toeldo but LOVED Segovia. The aqueduct is amazing and the Alcázar is so cool
. You will love it...it is a very charming town. Although I love Toledo ( especially in the evening when the daytrippers leave!) I would vote for Segovia with the kids and their ages.
I cannot give you any suggestions on hotels/hostels, but you should really read the former posts...do a search and you will find a wealth of information. Have a wonderful time! and let us know about your trip when you return.