whether milk has gone bad simply by removing the cap from the top of the milk jug and putting your nose to it. It will always smell bad. You're likely to think the milk has gone bad but it's probably fine. The top of the milk jug where the cap screws on acquires a sour odor within a few days of opening the jug, but the milk itself is usually fine unless it's past the expiration date.
Of course, if you're in the habit of leaving the milk out on the counter for 20+ minutes regularly, your milk will go sour well before the printed expiration date. Our milk is never out on the counter or kitchen table for more than a couple of minutes.