The upper-most stage of a launch vehicle is in essentially the same orbit as the payload. The stage burns out, and then the payload is separated from the stage. This is typically at a very low relative velocity on the order of meters per second, several orders-of-magnitude below orbital speed, which is measured in km per second. The separation velocity, and usually a post-separation collision avoidance maneuver performed by the stage, are just enough to prevent re-contact on future orbits.
An obvious exception to this are satellites that significantly change their orbit after deployment. The most obvious example is a satellite that is separated in geosynchronous transfer orbit (GTO) and then maneuvers into geosynchronous earth orbit (GEO).
So upper stages, if not intentionally de-orbited (which some are) can stay in orbit a long time. Stages have low ballistic coefficients because of the empty tanks, which will cause them to re-enter sooner than a more-dense satellite, but they can still stay in orbit for years.
Exactly how long depends a lot on the details: the orbit, the ballistic coefficient of the stage, and the solar cycle (high solar activity "puffs up" the atmosphere, which increases drag). Part of obtaining a launch license (in the US) is running a government provided code to calculate the de-orbit time for the payload and any spent stages. The best practice is to ensure everything is de-orbited (actively or passively) within 25 years.
See related answer to Why do malfunctioning satellites come back to Earth?