There are a few ways.
The simplest is to use 7 resistors in series, with the first 6 doubling in value and the last the same as the 6th. So 1-2-4-8-16-32-32 for example. You then wire the button to short one resistor each - except for the 'top' one. You then have a unique value for each button combination that you can sample with an A/D convertor. Note that you only need two wires to the keypad (assuming you can solder the resistor across the keys/buttons). The 7th resistor can sit near the microcontroller.
You can also put all buttons in parallel, with a series resistor that doubles in value for every button. Create a voltage divider with the buttons and a resistor that gives you the best range of voltage for the resistor values you chose for the buttons. This give a worse 'dynamic range' and 'resolution' compared to the approach above though - but a bit more math just for understanding below:
With 6 buttons, this gives you (for example) 10,20,40,160,320 and 640 ohm in series with a 640ohm resistor. The binary sequence will mean that every combination will give a different value - not trivial but you should be able to create a lookup table with all 64 values.
Note that you need to use an analog input with enough resolution to resolve the highest and lowest value and the two closest matches.
Highest value is 640ohm, lowest is about 5 ohm. 1:100 or so, no issue.
Smallest difference will be 10//320 = 9.48ohm and 10//640 = 9.69ohm
So you'd need to be able to detect a difference of 0.3 ohm on a 640 ohm scale, or 1:2100 or so. This means you'd need at least a 12 bit A/D convertor and low noise.
If the resolution and dynamic range of you A/D isn't enough, you could try some tricks with diodes and alternating the voltage sign (positive / negative) using two digital outputs. You'd need three wires though to go to the buttons.
This would give you two sets of 3 buttons which means a much better resolution but you'd have to deal with a more complex software setup to deal with this scenario. Not impossible though. With 10, 20 and 40 ohm making up a voltage divider with a 40 ohm resistor, you'd get the following voltages for a 5V source (ignoring the diode drop here):
R1 R2 R3 V
1E+18 1E+18 1E+18 5.00
1E+18 1E+18 40 2.50
1E+18 20 1E+18 1.67
1E+18 20 40 1.25
10 1E+18 1E+18 1.00
10 1E+18 40 0.83
10 20 1E+18 0.71
10 20 40 0.63
That said, if you're going to use 3 wires anyway, a 3rd way would be to ChaliePlex the buttons. This is a bit more complex software-wise but the nice thing is that you don't need an analog input. Google 'Charlieplex 6 buttons' for more info.