Fermi level in semiconductors
The concept of Fermi Level:
In simple term, the Fermi level signifies the probability of occupation of energy levels in conduction band and valence band.
In extrinsic semiconductors, the number of electrons in the conduction band and the number of holes in the valence band are not equal.
Thus, the probability of occupation of energy levels in the conduction band and valence band is not equal. Therefore, the Fermi level for the n-type semiconductor lies close to the conduction band and for p-type semiconductors, it lies close to the valence band. You can see the following example, this is the example of the n-type semiconductor, where Fermi level lies close to the conduction band,
In p type semiconductor, it lies close to valence band because holes are majority.
This is the concept of Fermi level in semiconductors.
In case of any doubt, please mention in the comment section.