Being tensless, chinese developed into modal language. There are two realis markers 了: verbal 了 marks relative realis and sentence final 了 marks absolute realis. So everytime you want to speak, you need to decied is the thing you are going to tell was/is/will be in "real world" or "was/is/will be in your head/dreams/desires i.e. "irreal world".
It's a bit like aspect and tense in English. Aspect marks relative time of the verb (relative to situation time) and tense marks absolute time (relative to speach time).
So I was sitting on the bus just reading a book when somebody tapped me on the shoulder.
Slanted words mark relative time (doing) (time relations between verbs inside the situation), bold words mark absolute time (did/was) for the whole situation.
IMHO perfectivity/completion has nothing to do with either 了. Perfectivity is being marked by other means in chinese (see 六年 in your sentences).
So with this in mind lets try to understand your list:
(A1)我学了六年法语了
First 了 is a relative realization modal marker (that is this V+了 tells us that you was learning the language before ??? (some time) what time is not clear though) but having 六年(perfectivity marker) after 了, transforms relative 了 to absolute realization marker (making it a past marker). So secondary 了 (which always marks absolute realization of the whole situations) is redundant.
(A2)我学六年法语了
- incorrect. The sentence is marked by absolute realis 了(past time) so nothing wrong here but "六年-thing" is just confusing. See Tang Ho answer.
(A3)我学了六年法语
- relative realis 了 made absolute by 六年, so everything is ok. It's just a plain old "past tense".
(A4)我学六年法语
- Without any of the 了's the situation is not rendered real! The reading of this sentence can only be in some irrealis mood. i.e. "I usually learn..." or "I always learn..." (yes, habitual mood considered irrealis in chinese) ect.
For (A5)(A6)(A7)(A8) see other users answers.
(B1)我学法语
(B2)我学了法语 well, this almost unfinished sentence because verbal 了 marks that the situation took place while/befor/ect but the tense of the situation is not marked explicitly. Some indication of "absolute tense" must be added.
P.S. When I was investigating the nature of 了 the most problems gave me this pair of sentences:
I was eating. vs 我吃饭
In 我吃饭 there is no information about tense. So I added it -> 我吃了饭 but this is ungrammatical! I couldn't understand why. But then I read one article and it struck me: The reason why natives (majority of them) think 我吃了饭 is incomplete is due to 了 being relative. It translates to english as "I eating (for real and it's not a fantasy or wishful thinking)".
You see, in "I eating" there is ONE problem - there is relative tense marker (-ing) but no absolute tense information! In other words we can ask: "WHEN you eating? Past? Present? Future?" You have to add absolute time to this sentence: "I was/is/will be eating."
The same thing with chinese: 我吃了饭 - we can ask "WHEN you eat? Yes, you told us that the "eating" took/take/will take place in reality(了) (by the time) xxxxx" but WHEN? By what time was/is/will it take place in real world? You have to add absolute tense to the sentence i.e. to render it to past, present or future!!!
Now, there are two ways (I know only two) to add absolute tense information to the sentence:
- by adding 了 to the end of the sentence.我吃了饭了
- by adding some perfectivity information. 我吃了一碗饭 (一碗 marks the
perfectivity).