Question 1: How can you tell which verbs take zai before the verb and those which take zai after the verb?
That just depends on what you want to say.
你住哪儿?
我住在北京。我在北京住。(both are possible, as Tang Ho pointed out, but there seems to be a preference for the first.)
你还住在上海吗?
不是的,我现在住在北京。
不是的,我已经住在北京三年多。
It is entirely possible to write: 在住:
1. 医学研究表明,那些年过40岁,肥胖,或是 在住 在发达市区的人群往往是糖尿病的高发人群。
(在住 = living, 在 ... 市区 = in urban districts)
Those aged over 40, overweight or living in well-off urban areas are at a higher risk of developing diabetes, medical studies have shown.
I often wonder what determines word order.
Question 2: Why has this word order changed?
The order of phrases can radically affect the meaning expressed, so we can take the phrases in any expression and calculate the number of permutations, rather than combinations, which is N! (N factorial.)
There are 6 (3x2x1) permutations of 3 variables:
Bit of Python: perChars3 = permutations(['我', '住', '在北京'])
Permutation 1 is: ('我', '住', '在北京')
Permutation 2 is: ('我', '在北京', '住')
Permutation 3 is: ('住', '我', '在北京')
Permutation 4 is: ('住', '在北京', '我')
Permutation 5 is: ('在北京', '我', '住')
Permutation 6 is: ('在北京', '住', '我')
With these 3 phrases, it is possible to discern the meaning in any order, although you probably would not write them all.
As we move to 4 phrases, the number of permutations rises to 24 (4x3x2x1):
Bit of Python: perChars4 = permutations(['我', '在北京', '住了', '三年多'])
Permutation 1 is: ('我', '在北京', '住了', '三年多')
Permutation 2 is: ('我', '在北京', '三年多', '住了')
Permutation 3 is: ('我', '住了', '在北京', '三年多')
Permutation 4 is: ('我', '住了', '三年多', '在北京')
Permutation 5 is: ('我', '三年多', '在北京', '住了')
Permutation 6 is: ('我', '三年多', '住了', '在北京')
Permutation 7 is: ('在北京', '我', '住了', '三年多')
Permutation 8 is: ('在北京', '我', '三年多', '住了')
Permutation 9 is: ('在北京', '住了', '我', '三年多')
Permutation 10 is: ('在北京', '住了', '三年多', '我')
Permutation 11 is: ('在北京', '三年多', '我', '住了')
Permutation 12 is: ('在北京', '三年多', '住了', '我')
Permutation 13 is: ('住了', '我', '在北京', '三年多')
Permutation 14 is: ('住了', '我', '三年多', '在北京')
Permutation 15 is: ('住了', '在北京', '我', '三年多')
Permutation 16 is: ('住了', '在北京', '三年多', '我')
Permutation 17 is: ('住了', '三年多', '我', '在北京')
Permutation 18 is: ('住了', '三年多', '在北京', '我')
Permutation 19 is: ('三年多', '我', '在北京', '住了')
Permutation 20 is: ('三年多', '我', '住了', '在北京')
Permutation 21 is: ('三年多', '在北京', '我', '住了')
Permutation 22 is: ('三年多', '在北京', '住了', '我')
Permutation 23 is: ('三年多', '住了', '我', '在北京')
Permutation 24 is: ('三年多', '住了', '在北京', '我')
Some of these permutations seem more acceptable than others.
Which ones would our Chinese friends here accept?
In a language without any case markings, shifting the word order can change the meaning completely: 我打你。你打我。
So, I believe language will kind of self-regulate the possible word orders to preserve the meaning. However, the number of acceptable possible word orders will not always be 1.