What is an aftermarket ROM?
When you purchase an Android phone operating system is there, pre-installed. After year or two new versions of Android are unveiled. You start to think if your phone will receive a new version of Android. Usually one bigger update can be expected.
Since the source code of Android is available for free and can be reached by anyone there are many developer groups offering their own derivative versions of Android. These, so called aftermarket ROMs are invaluable for those not receiving Android updates. Your phone might have many extra years ahead.
For example my Nexus 4, first introduced in November 2012, is no longer supported by Google. That is, Android 6 and 7 never happened to Nexus 4. I'm supposed to stick to Android 5 or try to find an aftermarket ROM based on Android 6 or 7 source code.
Is there an aftermarket ROM for my phone?
Bummer. Not all phones are supported! However if you happen to own a Nexus phone chances are there are several ROMs available. You can start digging
CyanogenMod site. See if your phone model is among the supported ones. If you don't like CyanogenMod (supported by Microsoft) move on to
OmniROM or
XDA-Developers, just to name some. Remember, the older phone the worse chances.
Ok, a ROM found - how do I flash it?
This is a sticky one. First you need to get your PC ready for flashing by installing adb and fastboot. Next, your existing Android needs to be unlocked and debugging has to be enabled. If you are familiar with Windows or Linux setup chances are you'll learn how to flash your phone as well.
Take a look at these instructions from Cyanogen Mod; how flash Nexus 4.
Bear in mind mobile devices are somewhat different from PCs. When flashing for the first time a lot of coffee and patience is needed. One more thing: do not flash a phone you need every day. If you fail you are holding a brick in your hand.
Is it worth it?
Ok, flashing takes time, it is dangerous and might make your phone useless. Is it worth it? Absolutely! My Nexus 4 is from year 2012 and is still able to run the latest Android 7 which is not officially available but can be found with the name CyanogenMod 14. One might say my phone's new OS runs slow and lags. This may happen if there is not enough RAM memory available. However Nexus 4 is powerful enough to run the latest Android.
Conclusion
There are new phones like Google Pixel available. Those new devices are very tempting but expensive. If you happen to own a flashable phone why not give it a facelift and flash it. That way your phone will get extra years of living and there is no need to purcase a new phone that often.
Nexus 4 running an unofficial
CyanogenMod 14 (aka Android 7)