Staying airside
At many airports you can change planes without a visa if you don't leave the transit area. Some countries still require an airport transit visa depending on your nationality.
Leaving the airport
If your stopover is long and you want to visit the city, you need the country's entry visa. Also check whether your bags are checked through to your final destination.