"Has a value of" vs. "has the value of"
When the value is subject to change, then has a value of N is correct, it implies at different time or circumstances, the value may be different. Over time, the train will move at lots of different speeds. The value of gold changes depending on the market. The value read from a capacitor changes depending on charge time and voltage.
He has a major in social work. This implies he could have other majors in different subjects.
It has the color of rich deep caramel. This implies the color property does not change. Whatever "it" is, we wouldn't expect it to be blue tomorrow or black yesterday.
Using a or the implies variability in the value. There will be many examples, as you have cited above, that appear inconsistent with this. I'd put it down to most writers not being philosophers or logicians, and they write what sounds appropriate, using a or the almost interchangeably.
First, I note that my response to the fill-in-the-blank exercise is not what the OP expected. For me, the most natural answer to "What speed?" is "A speed of 5 mph." I don't know if this is a Germanism (I think my native German works that way), my déformation professionnelle as a mathematician, or just how English really works.
My first intuition for the general phenomenon is that "a ... of ..." is shorthand for "a ... that has been measured/determined to be ...". My second intuition is that this actually makes sense because in most cases we are dealing with approximations rather than exact values, and approximations are not determined in a way that would justify the definite article. (This also justifies my fill-in-the-blanks response.)
We can talk of the speed of the train, even though it (a) is variable and (b) can't be measured with infinite precision. However, the speed of the train is not "the" speed of 5 mph. It is actually one of many speeds (e.g. 4.9814264 mph) that fall into the class of speeds to which we refer as (approximately) 5 mph.
Obviously the examples involving precise dollar values cannot be explained this way. The explanation here is probably that the reasons given are valid for most other types of values and the choice of article is determined grammatically rather than semantically.
Whereas speed and value have a strong bias toward the indefinite article, with price we usually have a choice between indefinite and definite, and amount even has a bias toward the definite article.
Technical terms of mathematics such as sum are special cases. In principle they seem to behave much like price, with a choice between a and the. However, both are best avoided as they can lead to ambiguity or at least irritation:
- Having determined a sum of 4,291 Euros, ...
- Having determined the sum of 1,381 Euros and 2,910 Euros, ...
- Having determined the sum of 1,381 Euros and 2,910 Euros as 4,291 Euros, ...
- Having determined the sum as 4,291 Euros, ...
- Having determined the sum of 4,291 Euros, ...
The problem with 5 is that it's not a priori clear whether it's parallel to 1 and 4 or to 2. Even 1 itself is not completely unambiguous and could be interpreted as parallel to "a sum of ... and ...". In other contexts the workaround of using as is not possible.
(Note: Prescriptivist extremism has caused a bias towards treating obviously uncountable measurements such as 5 mph as countable and applying "fewer" to them instead of the natural "less", just because they involve a number that happens to be approximated by an integer. Maybe this question is somehow related.)