AI = Auto Indexing. Original F-mount lenses relied on the little "rabbit ear" device on the edge of the lens (located at f/5.6) to communicate to the camera what the maximum aperture of the lens was. (Maximum here meaning largest aperture/smallest number.) You'd mount a lens, turn it all of the way in one direction and then all of the way in the other direction, and the camera would know the limits of the lens. The bodies had a little rod that stuck out and mated with the slot in the "rabbit ear".
With AI lenses, there's a ridge at the end of the lens barrel that mates up with an tab on the camera body. The act of mounting the lens moves the tab and the body knows the maximum aperture of the lens from how far the tab moved.
Mounting a lens without the AI ridge (now referred to as "Pre-AI") on a body that requires it (like the FE2) can damage the camera. You can have a Pre-AI lens modified to work with an AI camera...these lenses are generally referred to as "AI'd". Mounting an AI lens on a pre-AI body is not a problem as long as the lens has the "rabbit ear" on it. (Nikon kept their lenses backward-compatible by including the rabbit ear on everything except the Series-E lenses, right up until their autofocus lenses. They stopped including it on autofocus lenses, but the lens can be retrofitted with the rabbit ears if you have a really old Nikon body that requires it.)
Over the years Nikon has "sorta' - kinda'" kept their lenses compatible...but the complexity of what lens works with what body really has gotten out of hand. If you have a really old Nikon, then everything except for Series-E and autofocus lenses work out of the box. If you have an FM, FE, or F3, you can use AI or Pre-AI lenses. If you have an FM2, FE2, or FA, then you can break your camera by mounting a Pre-AI lenses. You can't use G lenses on any of the manual Nikons because G lenses don't come with aperture rings. The F5 can be retrofitted to work with Pre-AI lenses. And on and on...ad nauseum.
If you have a Nikon body and want to know what lenses will fit, it's best just to search the web and find one of the many tables that exist that tell you what lenses give you what features on what bodies. Basically, pro bodies work with (or can be modified to work with) just about anything. Mid-grade bodies work with the lenses that were made when the cameras were made, and sometimes newer ones. Consumer grade cameras get more limited...sometimes you can mount a lens but the camera won't meter.
Sorry for the confusion...there's no simple way to describe all of the various versions of the lens mount that Nikon's used over the years. Physically the mount has changed very little, but those small changes have made big differences in what works and what doesn't.