There are many ways of storing images. It evolved somewhere along the following lines.
Early home & personal computers used characters. The screen was divided up into a number of character rows and columns. Each cell contained 8 bits, or 1 byte, which can contain one of 256 distinct values. Typically this was ASCII with the last 128 characters as either graphics or user defined.
User defined characters were each defined by 8 bytes, or 64 bits. A character was 8 rows by 8 columns, and so you could define any pattern you liked.
Initially this was black and white. No colour. Later, colour was added. Each cell had an additional 4 bits of colour associated. (2 cells per byte.) Some display adaptors handled 8 colours and then an additional 8 flashing colours. There weren't many standards, so typically they did what they thought was cool. Comodore for example used a byte of colour info per characters. 4 bits for the foreground colour, and 4 bits for the background colour.
To display the screen, the display card would look up the characters in the screen buffer, and then look up the bit battern for the character in rom. (Or ram for user defined characters.) If colour, it would also access the colour for the character.
Eventually people decided it would be cool to have bitmaps rather than characters. This allowed for graphs, charts etc. (and later arcade games.) At first each pixel either had a single bit (black & white) or 4 bits (16 colours). This took much more memory than the original 1K-2K screen buffers 38K for black&white, 150K for 16 colours. As this used so much more memory, some cards were limited to 320x480 or less in colour mode.
It wasn't too long before people grew tired of the limited colours, so the palette was invented. The colour palette was a table of 16 enteries. Each entry described a colour. Now, you could choose which 16 colours you wanted to display, and assign each pixel an index into the colour palette.
Now of course, 16 colours isn't many. So when memory became cheap enough, the palette was expanded to 256 enteries, and each pixel took a byte. Then came 65536 colours. Now I'm not sure to be honest if this uses a huge palette of 65536 enteries, or if it split the 16 bit word into 3 RGB parts. Eitherway, this gives fairly decent images, especially when used with dithering techniques which had been evolving for years by now and were becoming very decent. Actually, dithering is a whole different topic. But check out some early computer art done a a daisywheel printer. (One that only prints characters.) When the dot-matrix printer came along, people did wonderful stuff with grey scales and careful dithering.
Then at last, colour became true colour. 24bits. 8 bits per componet of RGB. This gives pretty decent colour for most people, but is really optimised for the raster display device. (CRT) It actually sucks for grapshic artists who use a much large colour space than a CRT can display. They use various other colour schemes such as HSL, CMY etc.
As Shalmanese mentions, some devices use 32bit colour, where the additional 8 bits is for alpha blending. Say you have two pixel, blue and red. When they are mixed, the alpha value of each determins how much blue and how much red is in the final pixel. The alpha value does not affect how the image is displayed, only how it is blended with other colours.
Edit: Stole credit from CTho9305 and gave it to Shalmanese where it rightfully belongs 🙂
(Thanks CTho9305!)