A rotary encoder has a fixed number of positions per revolution. These positions are easily felt as small “clicks” you turn the encoder.
The Keyes module that I have has thirty of these positions.
On one side of the switch there are three pins. They are normally referred to as A, B and C. In the case of the KY-040, they are oriented as shown.
Inside the encoder there are two switches. Once switch connects pin A to pin C and the other switch connects pin B to C.
In each encoder position, both switches are either opened or closed. Each click causes these switches to change states as follows: