Basically, Google pumps out a new version of the android operating system every 6-12 months. The current version is android 4.2 jellybean and has been out only a few weeks.
It is up to your phones manufacturer whether or not it gets updated. These updates take a lot of time on their end, and if your device is nearing the end of its product cycle, it isn't feasible for the manufacturer to put time and money into updating it when more and more if that phones users are upgrading.
There is also hardware to consider. Top of the line phones have the latest quad core 1.5 GHz processors, 2gigabytes of ram, ect. If your phone is more than a year or two old, its just not going to be able to run the new operating system up to the usability standard that was set.
This is where the computer analogy doesn't work. Mobile tech is moving wayyyy faster than the desktop. This isn't the same as comparing your 2 year old computer with your 2 year old phone. Your computer can probably handle windows 8 just fine. Your phone most likely can't handle 4.2
If you want to make sure you're always going to be on the current version, make your next phone a nexus device. Google handles the updates for these phones and you usually get the update within the same week its announced/released.
My nexus 7 tablet gets it the same day.