It is used by your Network to identify the following
1) The first two numbers is RBI (Reporting Body Identifier) = who registered that type of phone ( verify here )
2) The next four numbers is TAC (Type Allocation Code) = what type of unit and its complete specifications
3)The next two numbers is FAC (Final Assembly Code) = who manufacture it
4) The next six numbers is the Serial Number of the Phone
5) The last number is sort of a check sum, that verifies the previous numbers
Combined a total of 15 numbers is used by your network to get the complete information about your phone that is used against their database of Blacklisted phones and final approval to connect to their network, IF they were inaccurate or had complaints (like being stolen, not paid telecoms dues etc) it will be rejected and BLOCKED immediately from connecting to that Network
And also here to check if it is blacklisted
Your IMEI is also needed for networks to BLOCK your phone when needed as well as ANTI theft apps.
Hence if your IMEI changes or gets lost, it may fail to connect to the network, depending on the restrictions of that network provider.
It is clear that Flashing custom ROMS can cause your IMEI to Change or get deleted as they may be ported from another manufacturer or from another version of the same manufacturer as the IMEI embedded in the chip of your phone.
IF you want to AVOID this problem, safe you EFS folder the moment you think of Flashing any ROM that is NOT the original Firmware for that phone
It is noted that to resolve this problem you have to return to its original firmware to recover your embedded IMEI and do a progressive upgrade . eg. from GingerBread to ICS before going on to Jelly Bean
This post is linked to Pit Stop