GRUB is an abbreviation for GRand Unified Bootloader, its actually a product of the GNU project aimed at creating a bootloader which can boot nearly all operating systems. So now what is a bootloader? We shall now know this in nearly a layman’s approach.
When you switch on your computer, it fetches which operating system to boot from a special place on the hard disk called Master Boot Record(MBR). After that the required operating system is started. This does not need any complications if you have jus one operating system. Now if you have more than one operating system, the new circumstance are explained below.
Consider that there are two friends who got an internet connection and want to share it. What would they do? They will get a hub or a switch to split the line into two so that both of you can get a chance. In the same way consider a bootloader to be like a hub or a switch. It is placed in the MBR and gives you the option to boot any of the many OS which you might be having on your system. Now let u see how this happens.
Your computer is powered on. The contents of the MBR is checked for booting the OS. GRUB should be placed at the MBR so that it can be booted. Now you get a menu at the GRUB to boot your choice of OS. Just select the required and press Enter. That’s done.
Actually GRUB is not completely installed on the MBR. The size of MBR is very small- just 512 bytes. Actually on the MBR only a small portion of GRUB is placed whose function is the bring up the complete GRUB(bootloader). Thus we can say that MBR contains a pointer to the GRUB which is actually located on some other portion on the disk.
Troubles that can crop up:
If you have GRUB installed on some partition say on partition X and a pointer to this partition on MBR. Now if you by mistake delete that partition or format it, you will lose you GRUB though a pointer may still be containing on the GRUB. So now even though GRUB is on your MBR, you still cant boot any of your OS and you would be greeted by some error message like GRUB error 15,GRUB error 17 or GRUB error 22 depending on the case.
If you have installed Windows after installing Windows you must have noticed that GRUB has vanished. Actually it does not vanish, what happens that Windows replaces itself to the GRUB unhooking GRUB from it. Now GRUB is installed on your computer but still its does not have pointer from the GRUB, its useless now. You need to put GRUB back to the MBR for restoring the original conditions.