I am going to guess the LS04 is happy with a floating input as being a TTL one level, the rest are not, they expect a valid logic one level, and if the output is not actively driven to 5V you need a resistor to pull it up to 5V. A value between 1k to 4k7 will work, depending on the capacitance and what is also attached to the pin. If it is a long string of LED's then 330R to 560R will work, but if it is just the gate alone being driven direct the 4k7 will work.
TTL treats any voltage above 0.8V as logic one, and real TTL provides a pull up current by it's design. CMOS gates need it to be over 2V4 ( or 3V for some CMOS) and do not source any current from inputs to pull it up if it is an open collector ( or drain) output, they need the resistor to 5V or an active pull up to work.