How is the level of a Greater Rift Keystone decided?
The level of the Greater Rift Keystone obtained by completing the Realm of Trials is determined by the wave you killed last. The wave level is determined by how fast you killed the previous wave (note the timer on each wave). It always starts at 1.
This metric has been slightly described in more detail for multiplayer groups. A group of 2 receives a key equal to the level complete minus 4, group of 3 gets a key equal to minus 5, and a group of 4 gets -6.
What determines how many levels Urushi gives to the next Greater Rift Keystone at the end of a Greater Rift ?
Of 15 minutes,
0-3 minutes taken: level + 9
3-4 : +8
4-5 : +7
5-6 : +6
6-7 : +5
7-8 : +4
8-9 : +3
9-10 : +2
10:30+ : +1