Hmm for most (all?) image formats, it starts off with a header of some sort, that describes the width/height of the image, and other things, and then comes all the actual pixel information. Depending on the image format, and settings (for eg bmp has multiple different settings, like 8 bits per pixel, 16, 24, 32 etc), the data information has to be interpreted differently.
The easiest way to do this would be to find some image loading code online in the language of your choice and look through it. Of course, having a tutorial that tells you the file structure is very useful (wikipedia usually has good information).
If you're doing it in java, the ImageIO class is capable of loading images from disk, and you can retrieve the pixel information from an Image class it returns. I'm pretty sure code like this exists for most other common languages though.