The most basic encoder is a disk with 2 sectors which can be detected by sensors, it doesn't matter what type of sectors are used or what type of sensors are used as long as there is a clear ON and OFF signal. One sensor is placed at the top of the disk, and as the disk begins to turn the sensor will pick up a series of transitions from ON to OFF and from OFF to ON. By measuring the time between transitions it is possible to calculate the rate of rotation of the disk but there is still no information about the direction of rotation.
If another sensor is placed at the side of the disk a second signal will be generated but with a delay relative to the first sensor. After the first sensor transitions to ON the disk must turn an additional 90 degrees before the second sensor also transitions to ON. However, if the disk rotates in the opposite direction the second sensor will transition before the first. By knowing which sensor reads an ON to OFF or OFF to ON first, it is possible to determine the direction of rotation as well as the rate!
The sectors themselves can be anything, holes detected by an optical sensor (popular in computer mice), metal strips detected by a metal detector, pits and lands detected by mechanical switches or conductive and non-conductive areas detected by sliding brushes. As long as there is a way to generate a binary signal it is usable in an encoder.