How do they choose which countries host the Olympics?

They usually gather all the countries and have a vote for whichever country hosts the Summer and Winter Olympics