Ultra-basic question: where is the voltage in this simple circuit diagram?
The 74HC04 will have power (Vcc) and Ground connections - often not shown in schematics.

For the first diagram, with the switch closed, the input to the inverter will be grounded (at logic Low), and the output will be a logic High (we don't care what, if anything, is connected to the output).  

The 74HC04 is a CMOS part, and has a very high input impedance.  When the switch is open, the input to the 74HC04 can "float" around to any random value - the inverter does not force it to any defined state, so the input may be considered either high or low depending on the exact voltage, and the output will then be either low or high.

In the second drawing, the input will be a definite high with the switch open, but closing the switch will short-circuit the power supply - current will flow directly from Vcc, through the switch, to ground.  The inverter can be ignored as it will have no power supply, hence won't work.

The correct circuit is:







simulate this circuit &ndash; Schematic created using CircuitLab

In this circuit, with the switch open, the resistor will pull the input of the inverter up to Vcc, so the input will be seen as a High.  As the input to the gate is a vdery high impedance, there will be no current through the resistor, hence no voltage drop across it. Closing the switch will pull the input to Ground, but the resistor prevents a short circuit between Vcc and Ground. In this case, there will be some current flowing in the resistor.