One of the first things one learns in electronics is how chip pins are numbered. In the common dual in-line package (DIP) pin numbering starts from the left side of a notch appearing on the top of the package and continues counterclockwise until it reaches the other side of the notch. Why are pins counter-intuitively numbered in a rotating fashion rather than by columns as one would expect for a rectangular package? And why is the numbering not following the direction of a clock's numbers? I think that both decisions can be traced back to history.

Before the advent of integrated circuit chips and transistors, electronic circuits were built using vacuum tube valves. In time simple three-pin diode valves evolved into more complex configurations with multiple pins, such as those for the plate (anode), one or more grids, the cathode, and the heater. As vacuum tubes are rather bulky it would be natural to number these pins while looking at them from their bottom side. Furthermore, to avoid mistakenly inserting a tube into a socket with the pins in the wrong order, many tube sockets, such as the octal one, introduced a key in the rib post to fit an indexing slot in the socket. This was naturally placed between the first and the last numbered pin. You can see both features in the picture above and the diagram below, which depicts the tube's pins viewed from below.

Integrated circuits seem to have inherited this numbering scheme from vacuum tubes. If we look at a chip from underneath, its pins are numbered clockwise in a circular fashion, just as a tube's would be. It gets better: the notch between the chip's first and last pin (see picture below) corresponds to the tube's key.

Chips are a lot less bulky than vacuum tubes, so we always handle them from their top side. From the top view, their pins are counter-intuitively numbered in a counterclockwise fashion (see first diagram above). Chips are also rectangular, rather than circular. However, they retain the tubes' circular numbering pattern and when viewed from the bottom the numbering corresponds to the one of their distant vacuum tube ancestors.

Image credits.

Tube picture: Mataresephotos — CC-BY-3.0; chip pin numbering: Peter Halasz — CC BY-SA 3.0; 7AK7 tube numbering: own work — CC-BY-SA-4.0; 555 IC: Stefan506 — CC BY-SA 3.0