A rack is essentially a gear with an infinitely large pitch diameter and root diameter. In simple terms, it is nothing more than a "straightened" gear. As a result, the geometry of the rack corresponds to the unwound geometry of a gear with involute toothing (other types exist). As part of the machine elements, it serves to transmit forces.
In combination with a gear, also called a pinion, it is called a rack and pinion drive. The aim here is to change between a translational movement and rotational movement.