What is the function of "一" in the sentence 要上山，只有这一条路?
要上山，只有这一条路。
To go up the mountain, there is only this 1 road.

Here, 一 is the number 1.  一条路 = &quot;one road&quot; (wherein 条 is a measure word).  So we could change it to any other number, e.g.:

要上山，只有这六条路。
To go up the mountain, there are only these 6 roads.

Replacing 这一条路 with 这条路 above is fine: with the number omitted, the default quantity is 1.
In 人的一生中, the 一 is part of the word:

一生 (yī​shēng​)
CC-CEDICT: all one's life / throughout one's life

If we delete the 一 from the word 一生, we'd obtain 生 which is a completely different word.  So we can't delete the 一 here.
More generally:

There are a bunch of words and idioms containing the character 一 (e.g. 一生, 一起, 一样, 一叶障目): by deleting the 一 from within a word, we'll almost always end up with nonsense.

There are a number of grammar structures that also use 一, such as 一……就…….  Occasionally it's okay to omit the 一, such as how 一边……一边…… is sometimes written 边……边…….  However, I'd guess for most grammar structures involving 一, it won't be okay to omit the 一.

It's often okay to omit the 一 before a measure word: 她是一个孩子 = 她是个孩子 but I don't think it's always okay to omit it: I wouldn't start a sentence with a measure word (e.g. I wouldn't write 一匹马在吃草 as just 匹马在吃草), and omitting it in 一个人 might result in confusion with the word 个人.