There is no one answer to this question. Depending on what passport you hold, what countries you are traveling to, and sometimes even what countries you are traveling through on a layover, you may need to get a visa. The best way to know if you need a visa is to check the U.S. Department of State website if you are a US passport holder or the website for whichever country you do have a passport in.
Make sure when searching online for your visa requirements that you confirm that the information you are reading is applicable to your passport. Also make sure to search both your flight’s destination country, any country you have a layover in, and any country you plan to travel in after flight arrival. While not every country/passport combo requires visas on layover, there are some that do.
If you do not have a visa that is necessary for your trip you may be denied boarding.