How does bipolar line coding such as AMI work with medium like fiber optics
how many different light signals can be produced to support bipolar
encoding?is it a limited number?

Several different light signal levels can be used but the number is limited by a couple of things: -
The transmitting laser diode will have a range of light level outputs ranging from a low level to a high level as shown in this picture: -

As can be seen, you have to avoid letting the laser current drop below \$I_{TH}\$ because coherence is lost and there can be a significant delay (loss of data) in restoring the device into proper laser action. And, as the device warms up, the light level will change for a given data modulation of the bias level. \$I_{TH}\$ also rises with higher temperatures and the &quot;operational&quot; slope decreases.
Taking all these things into account and assuming that the laser drive levels can be corrected on-the-fly means there are only a handful of distinct light output levels that can be used. I can't put a number on it but I'd have thought 8 might be too many whereas 4 is probably achievable (taking into account the whole system). The extinction ratio (maximum usable light output divided by minimum usable light output) for a laser might only be 10 dB - that's the whole dynamic range the laser can produce so any intermediate levels have to fit into that range.
Some laser diodes will be better; some will be worse.
The 2nd thing is basic signal-to noise at the receiving end. The light levels get attenuated by the fibre and therefore the signal levels at the receiver can be quite small and the self-induced noise at the receiving photodiode has to be significantly below the signal level or you will get bit errors. This brings into action the Shannon–Hartley theorem: -

This theorem supports the idea of using multiple levels to represent binary numbers but, the larger the noise, the fewer the number of different levels are allowed and data throughput drops. It's a big subject.
Finally (and I'm sure there's plenty of other things to consider) is the demodulation process and the data formatting. If each symbol transmitted has (say) 4 levels (i.e. can encode a two-bit binary number), given that there are drifts on the system (as well as noise), you have to ensure that each of those four levels is sent regularly so that the receiver can &quot;calibrate&quot; itself should things drift off in one direction or the other.

so does each tiny fiber represent one light signal?

Each fibre is likely to be unrelated to the other fibres and hence each fibre may send pure 1 and 0 digital data or use a multi-level transmission as described above.

since fiber optics uses a lot of tiny fibers, so I guess it is
parallel transmission?

The concept of the arrival of simultaneous parallel data bits is fraught with practical problems because if one fibre is longer than the others or one optical interface is a bit slower than the others (propagation delay), it will mean you have significant bit misalignment problems. If all the bits are shipped out serially these problems cannot happen and, in the long run, at high data rates, serial transmission proves to be faster than parallel transmission AND uses far fewer resources.