Why does the output of NOT gate (in a 74LS04 IC) equal to one when the input wire is not connected to anywhere?
You are not driving the inverter with valid input so don't expect to get a valid ouput either. So don't leave pins unconnected as they are floating at some unspecified voltage and the inverter migh be halfway between on and off states. And you cannot see with a voltmeter if it is even stable or does it oscillate at some high frequency.

Floating TTL inputs tend to be biased high by the internal circuitry, thus a floating input should be read as logic high by the chip, which means the expected output from the inverter should be logic low.