A Megapixel is simply a unit of graphic resolution equivalent to one million. Or more precisely 1,048,576 (220) pixels. Megapixels are often used in marketing new camera sales because people always assume bigger is better. It's good for sales!
That said, if you have a photo and you want to figure out the Megapixel count of that image this is what you have to do. Simple multiply the resolution of the image then divide by 1 million.
For example this photo iPhone 6 Plus sample photo by Flickr user Janitors is 8 Megapixels at full resolution however when embedded below (on this webpage it's only 0.3 Megapixel)
(620x465 ~0.3 Megapixel)
So if your photo has this resolution:
3264 x 2448
Do the following simple calculation:
3264 x 2448 = 7,990,272
7,990,272 / 1,000,000 = 7.990272
So this image would basically be 8 Megapixels or 8MP. As a general rule you just round up or down accordingly.
1024 x 768 = 786432
1600 x 1200 = 1920000
2048 x 1536 = 3145728
3264 x 2448 = 7990272