Visa: What do I need?
Visa requirements depend on your nationality, length of stay, purpose of trip, background and more. So always check with your Ministry of Foreign Affairs or the embassies of the countries you are visiting.
Do I need a visa if I only change flights (transit)?
In most cases a transit visa will not be needed, but there are some exceptions to this rule, for an example both the USA and Canada require you to have a Visa when you only transit in their airports. So it is highly recommend you always check with all countries involved in your itinerary for exact rules for your nationality. Remember also to check countries where you have a 'technical stopover' which means you do not change flights where the stopover takes place but continue on the same flight you came on.
If you change airports it will no longer be considered a transit and you will have to check the applicable rules for a 'normal' visa.