Generally speaking:
- if 了 is within a single content word, it should be produnced as "liao".
- if 了 acts as an independent auxiliary word indicating a change of state or introducing a new situation (Verbs have no past tense in Chinese, therefore some auxiliary words would be used to indicate it), it should be produnced as "le".
In Chinese sentences, there are no blanks to separate the words. Therefore you must separate them in your mind.
In this sentence, we can separate words like this (just do separation, it is not a correct translation):
我 用 了 很多 年 才 了解 什么 是 武术。
I used many years to understand what is KongFu.
Yeah, 了解 is a single content word (verb) meaning "understand" (we can't separate it into 了 and 解)