Pretty much hourly - or more often - on weekdays.
Demand-based pricing (like airlines)... but currently anywhere from 40 euros for non-refundable coach up to 250 euros for fully-refundable first class.
I would allow an hour from when you pick up your bags until you arrive at Atocha train station (careful, regional train will first stop at a different RR station - Chamartin). From there the schedule shows 3 hours or less block time to Barcelona. The regional trains depart every 15 minutes and take about 20-30 minutes IIRC.
If you time everything just right, you could probably be to downtown Barcelona more quickly via train. But if all the flights are on time, it would most likely end up about even, especially if you end up having to wait for one or more trains.
www.renfe.com for train info.
Bill