I'll be using similar terminology to this site, which has more technical details and less photos:
Summary of the K-Mount Evolution, Names, and Features In these photos, I put the slot for the lens locking pin at the top, so they are all oriented the same. The aperture control lever is inside and slightly left. The red dot for installing the lens is behind the top of the lower left bayonet tab. At the bottom is the slot for the tab that communicates the aperture ring setting to the camera on "non-crippled" cameras. Pentax uses 5 screws, some other makers use 3 or 4.
The original K mount. This lens is the SMC Pentax 55mm f1.8. Pentax-M lenses are the same.
The KA mount. This is the Pentax-A 50mm f1.4. Lenses with different maximum apertures will have a different pattern of contacts and insulators. KA lenses have a retractable pin in the middle of the contact pattern that tells the camera when the lens aperture ring is set to A. You can see the button for this setting protruding on the lower left.
A non-Pentax lens with KA contacts and a pin for Ricoh program cameras. This lens is a Sigma 24mm f2.8. Note the different maximum aperture has different pins. The Ricoh pin is on the right side. See the next photos for why this is a problem.
The KAF mount. This lens is the Pentax-F 50mm f1.7. Notice that the contacts all look the same now, and the A contact is switched within the lens, not mechanically retracted. Also notice the slot for screw-drive auto-focus, in approximately the same location as the Ricoh pin. On Pentax auto-focus cameras, some pin designa can drop into the slot where the screw drive is, locking the lens onto the camera.
The KAF2 mount, just about identical to the KAF. This is the Pentax-FA 35mm f2.0.
The KAF2 mount for a Power Zoom lens. This is the Pentax-FA 28-105mm f4-5.6 Power Zoom. Power Zoom contacts are on the light shield inside the mount rim, on the right side, just above and inside the screw-drive. These contacts are also used for SDM focus drive, although with different signals. There's room for a third contact here for future technology.
The "crippled" KAF2 mount. This is the Pentax-DA 16-45mm f4. Lenses with no aperture ring have a fixed round pin in the slot at the bottom instead of a tab that follows the aperture ring. Contacts are the same as all the KAF lenses.
The basic M42 screw mount. This is a Super-Takumar 85mm f1.9. It's old enough to have worn threads. The thread diameter is 42mm, thus M42. The chrome pin stops down the lens. A tab switch (upper right) changes the aperture operation from Auto to Manual.
The variation for open-aperture metering on some later-model screw-mount cameras. This is the Super-Multi-Coated Takumar 150mm f4. A square protrusion indexes the lens. A tab in an arc tells the camera what the aperture ring setting is. A small pin on the left and half-hidden locks the Auto/Manual switch in Auto until the pin is depressed.