Where do the many hotel booking websites get their hotel data? ie. # of free rooms within certain dates, price per night, etc.
Is it possible to get the data somewhere and handle booking myself, i.e customers book and pay through my website? Or is this only possible through apis? If so, which apis can I use?
There are huge companies that manage relationships with the various airlines, hotel chains, rental car services, etc. and make that information available to those who pay them.
They usually get this information from direct contact with the hotels or some contract with tourist agencies that collect them. You do not specifically ask, but the way this is organized vary by country and in each country different systems created by tourists agencies may exists. Also, in each town that is tourist place this information is usually collected by local tourist information centers. "Booking" part involves some logistics and may require direct contact with the hotels or some booking system but this again varies by country.