Why is there such a difference in the amount of internal memory? So first, when I go to Settings -> Apps this is what is shown:


(Click image to enlarge)

After some time ~20 seconds, the amount of space left is this:


(Click image to enlarge)

Why does this happen? What does this mean? And when installing any Android app I always get the insufficient storage space error. Why?  When determining the amount of space that is free, which of the two screenshots' storage space  does the Android OS consider? Anyhow, in both the cases the minimum that I had was 40MB and the app that I wanted to install was 12MB, yet I got the error.  I am running on HTC Legend, Android 4.1  Please clear this confusion. Thanks!
Your confusion is most likely caused by the way the Playstore handles installs/updates. They are first downloaded and stored in internal storage (not on sdcard, but /data/local), then the app is to be installed on the same partition (/data/data/app.package.name) -- only after that the download can be deleted.

In your case, this would mean a 12M download, which then needs to be unpacked (at least another 12M, or rather more) -- which could sum up to 30M or more. A safety margin needs to be kept to keep the device from crashing -- so you get the "insufficient storage" error.

See also: Package Install via Market sometimes fails and gives seemingly random error message