A multiplexer lets you select one signal out of a group of (typically) 8 or 16, for both input and output purposes. Use this tag for discussing multiplexer chips.
A multiplexer uses back-to-back MOSFETs to choose a signal from a group of signals.
For example, for inputting to an analog pin:
The A/B/C pins tell the multiplexer which signal to forward (in this case, signal 2). Any voltage present then appears on the O/I pin (output/input) which can be connected to an analog input pin on the Arduino.
The A/B/C pins tell the multiplexer which signal to forward the output to (in this case, signal 7). Data written to the O/I pin (output/input) is then sent to the selected pin.
Strictly speaking, this operation is called demultiplexing.
How do you switch directions?
The multiplexing is bidirectional. What the driver MOSFETs really do is present a low resistance for the selected signal line (around 80 Ω) and a very high resistance for the other lines. Thus the bulk of the current (input or output) goes to or from the selected signal line.