I just took two photos on my smartphone. One of a table surface with nothing on it and another of a cluttered table top full of detail. The clear photo was 3.5 MB and the cluttered one was 5 MB. How is this possible? The resolution is the same so they have the same number of pixels. Why would one create a larger image file than the other?
This is not only possible, but extremely likely, when you're using a compressed image format such as JPEG. Data compression methods in general become more efficient as the data to be compressed decreases in entropy (try creating zip files of a large page of actual text vs. the same sized page of a single repeated character).
The more features or fine textured detail that an image contains, the less the compression can "cheat" by simplifying the data that it stores to represent the image when it's uncompressed. On the other hand, cameras that store images as uncompressed RAW files tend to produce similar-sized files per image, regardless of image content.
A lossy format like JPEG, because it actually discards some inessential data in a very clever way while compressing, can often achieve ratios up to 10:1 while still giving a decent representation of a typical photograph, while a lossless compression format that retains all data might only achieve 2:1 compression, or less.
This is absolutely normal. While the sensor always samples the same amount of data, the file does not need the same number of bytes to represent different images. The more details there are, the more bytes it takes to represent its contents.
This is particularly true of lossless formats like most RAW, DNG and TIFF. They use algorithms to represent the sensor data or image content in fewer bytes but there is a lower bound to how small such a file can be.
Lossy formats such as JPEG usually also vary in size by details but that depends. On some cameras you can choose between Size and Quality priority. With Size priority, the compression algorithm discards details until it fits with a certain size. Even that, if you take a shot with the lens capped, the file produced will be rather small. With Quality priority, a certain amount of details get removed during compression, so the file will vary in size more because it depends on how much details were in the scene to start with.
Here is an very interesting fact: It does not matter if the details captured are real or not. Noise adds variance in images which are equivalent to details for storage purposes. If you take a photo of exactly the same scene but at different ISOs, the higher ISO image will be larger!
If you have several dozen random JPG images from one camera (many scenes, but all of same image size) in a folder, and then sort them by file size ("details" view), it is hard to say what your pictures might be, but their JPG file size will vary (largest vs. smallest) probably at least 2 to 1, and extremes can be much more, possibly 8 to 1 (just for some number, there are no limits). The large file scenes will be full of very much highly detailed features (trees with many leaves, etc), and the smallest files will be very plain, almost devoid of subject detail (blank sky or walls, etc).
JPG compression can compress the plain bland featureless scenes much more effectively than a scene crammed with much tiny detail. The general idea of compression is to save only a few things to be shown repeated in many places, as opposed to saving many things to show individually.
All JPG images are 3 bytes per pixel (a pixel is one RGB color) when uncompressed in computer memory, but they are compressed much smaller when in the JPG file. This difference is called the JPG compression ratio. For example, an image size of 6000x4000 pixels (24 megapixels) is always x3 or 72 million bytes (68.7 megabytes) when uncompressed RGB in memory. However, the JPG file is compressed, and might be generally around 1/4 or 1/8 or 1/16 that size compressed (any value, compression depends on the JPG Quality factor selected, small files are low quality, large files are best quality). This JPG Quality factor will be a fixed menu setting in the camera, so likely the same unchanged value for all images from one camera.
But still the final file size will also vary with the degree of fine details in the scene. An example is shown at http://www.scantips.com/basics09b.html#size
The long answer has already been covered pretty well, which is that compressed file formats don't actually record every pixel. They do something along the lines of recording a particular color of a particular pixel and then recording "this color is used again at x, y, and z locations." This is (theoretically) fine if you've captured your image exactly as you want to shoot it. But if you need to change the colors, brightness, etc of an image, you'll find that you have very little flexibility as what you see is basically all that's been recorded.
The short answer is "if your camera gives you the option to shoot raw you really want to use it."
Create a 300dpi image in PS, say 5000px by 3000px, fill with white and save as a JPG, image quality on max. You'll have a JPG of around 1mb file size. Now back in PS go to filters and add some noise, no more than 1% so you can barely notice it. Now save the file again, same settings, JPG with max image quality. The file size (on disk) will now be around 6mb.
So, image size (in mb) is directly related to the pixel content of the image as well as the pixel content. Two images from the same camera using the same settings and exported from LR or PS using the same settings will be different if the image content is different.