Using Pullup and Pulldown Resistors
That 1M is there just to make sure that the ADC input pin isn't totally free-floating, and also gives a known voltage (+5) when no switches are pressed. This keeps the ADC from picking up ambient noise from the rest of the circuit.

The reason for the value of 1M is a compromise between a value low enough to keep the ADC input from acting like an antenna, and a value high enough to not overly skew the result you get when a switch is pressed. When a switch is pressed, that 1M is in parallel with the 'top half' of a voltage divider formed by the 1K resistors either side of the switch.