The old time manual Nikkors from circa 1977 had the designation of an AI lens and then sometime leading into 1981 the AI-S lenses replaced the AI; both AI and AI-S lenses will fit onto all modern day Nikon F-mount bodies with no issues and the lens are functionally identical.
With the release of the AI-S lenses however, there were some subtle changes external to the lens: the primary reason for AI-S was to use enable cameras to use program or shutter priority modes - this was important for the upcoming release of cameras with this function at the time and the AI-S lenses were designed to facilitate this. With this said, the lenses that had a AI and then an AI-S counterpart were typically optically identical.
But why does this matter to be able to distinguish between an AI vs AI-S lens, if the optical formulas were the same?