Rotary encoders are one of the most common electromechanical input devices these days, yet they are relatively complex both in buildup and usage. They provide two non-overlapping waveforms on two pins (plus a third common one) when turned, and they often also have a push feature.
The encoder being disassembled here had been damaged during product assembly (one of the leads had been bent when the encoder was pushed into PCB) that's why the leads have been already cut while removing from the PCB. The top three metal tabs on the following picture protruding from the black plastic are the remnants of the three leads of the encoder itself (A, B and common); while the two bottom tabs in the green plastic are there from technological reasons (the two leads of the push-contact are located on the other side of the device).
The top metal frame holds together the entire stack through four clips on the sides, which have been already pried off at the previous picture. Pulling it apart, it initially falls into three pieces - top metal frame with clips, plastic shaf, and the bottom contacts assembly.
On the bottom of the top metal frame, a complex ring stamped from springy brass foil is placed and held in place thanks to the four plastic tips of the bottom contact assembly protruding through holes up to the top metal clip when assembled. This springy ring together with set of holes in the shaft barrel's top provide the detents which determine the mechanical "clicky" feeling when turning the encoder. The precision of assembly ought to ensure that there is no transition on the encoder's outputs when the shaft rests in one of the detents.
The top metal frame provides also a bushing for the shaft. There is a fair amount of grease between the shaft and the bushing (and, inevitably, also on other nearby surfaces), to provide some mechanical resistance ("smooth friction") when the shaft is turned.
The bottom part of shaft holds the springy sliding contact ring. There are three contacts on a single ring, i.e. electrically all connected together. The contacts are paralelled for reliability. There appears to be no special metal inlay on the contacts, so the ring is probably made from appropriately plated steel or brass.
The sliding contacts ride on a segmented contact ring. This is overcast by the black plastic, so revealing the arrangement of the segments required some "surgery".
Note the ingenous arrangement of the segments, which together with the three sliding-shorting contacts provides the required two non-overlapping waveforms.
The segments are apparently stamped together to form a "wireframe"; then overcast by plastic while in the frame, probably multiple devices at a time in a matrix; then separated and the leads (on the bottom of the picture) bent, before being assembled with the rest of the device.
The bottom - green - part houses the pushbutton.
It is the common "clicky" type which is being pushed by a tip on the bottom of the shaft. The contacts are again stamped and overcast into the green plastic.
The whole disassembled stack:
This is an example of modern electromechanical device, which has to be mass-produced with dedicated machinery and tooling at a minimal cost, while providing high reliability and good "haptic" user experience.