Digital shift-in : 74HC165
This tutorial uses the CD4021 : http://arduino.cc/en/Tutorial/ShiftIn
Digital shift-out : 74HC595 http://arduino.cc/en/Tutorial/ShiftOut
This is a step-by-step tutorial for shifting out digital pins, http://learn.adafruit.com/adafruit-arduino-lesson-4-eight-leds/overview
Digital shift-in and shift-out registers can be cascaded. You can get many digital inputs and outputs that way.
With 2 shift-in and 2 shift-out ic's you have 16 inputs and 16 outputs.
For analog inputs, you need either a mux or ADC chips.
A mux (multiplexer) is like a switch that selects one of the analog signals.
Nick Gammon wrote a page about the mux : http://www.gammon.com.au/forum/?id=11976
The Arduino Mega 2560 has 16 analog inputs.
But if you use 3 mux ic's with 3 analog inputs, you can select 24 analog signals.
If you need high accuracy, you should use an external ADC chip.
What do you mean with analog out ?