Whether or not you can safely eat foods that have been left out overnight depends on the type of food it is that was left out overnight.
If it's meat such as hamburger, chicken, hot dogs etc then you shouldn't eat the food left out overnight because the meats could have gotten bacteria on them that you cannot see even though the meat might smell good.
However if the meat was left out in a cold room then it might be okay to eat but I would not chance it and just throw it out.
If it's other things such as non meat foods such as grapes, fruits, vegetables, noodles, soup without meats then it will usually be safe to eat those foods left out overnight.
I have eaten some pizza before that was left out overnight that contained sausage and cheese and I reheated the pizza in the oven the next morning.
It never made me sick but it could have if it had contained bacteria.
Always try to make sure to refrigerate any leftovers soon after you're done eating to prevent bacteria from growing on the foods and especially any meats.