Generally my limit is same-day, though I often don’t drink something that’s been sitting for a few hours.
Rule 1: Check for bugs.
Will you drink it the next morning?
Maybe
What about the water the next night if there is still some left in the same glass?
No
Does it matter what beverage it is?
Yes.
Water I feel the least concerned about. But it’s also easily replaceable.
Beverages with milk/cream, or that I want to be a certain temperature, I give the least time.
Juices are somewhere in between.
Some wines are ok to open, leave out, and re-usable later, at least for a few days.
Does it matter if you already took a sip from the glass?
Yes, but it just adds a little bit to the consideration.
What if it’s a bottle of something you started. How long?
The bottle reduces the bug risk a lot. Especially with a lid. But otherwise it’s about like something left in a glass.
Does it matter if it’s kept in the fridge or at room temperature?
Very much so… unless it’s just water, or alcohol that’s meant to be left out.
Does it matter if you drank from the bottle?
Yes. Makes it worse.
Something I haven’t drunk from the bottle, re-lidded and put in the fridge, I’ll consider ok for several days.
If it’s in a sealed bottle, and I’m the only one who drank from it (which I only very rarely do unless I’m planning to drink it all and/or I’m sure no one else will drink from it), then I’ll consider that ok in the fridge for a few days, too.