With version 1.1. there the contribution meter got removed. Before version 1.1 the contribution was primary calculated simply
on APM (action per minute). Pre version 1.1 the correct answer should have been "Do as much actions as you can". One way to
optimize the contribution was to switch to a role with the ability to spam as much actions as possible. If you were playing a
Rogue switch to Bard and spam Motifs while fighting event based invasions, rift or bosses.
With version 1.1 the contribution got normalised between the roles/souls. You'll get virtual the same amount of loot whatever
your role/soul combination is. You'll only have to participate a limited amount at the event to get the chance for the rare
or epic planarite drop. I remeber several times i had to fight a handful invasions while questing and got a rare or epic drop.
In version 1.1 it was better to fight invasions because for the amount of effort you got much more planarit comparing to
close rift (and if you defending a soulstone the invasions will come to you). With version 1.2 the amount of planarite for
fighting invasions got reduced to a third, but still give you more planarite comparing to the effort colsing rifts.
There is no exact calculation known but the Rift Wiki has some valuable explanations: http://telarapedia.com/wiki/Rift#Player_Rewards
A major factor is that you not fail the challange in the unstable stages (which get players "into higher contribution categories").
Contribution rating is based on tanking, buffing, healing and damage comparing to other players taking part on the rift event (the rating is adjusted on the player level). There are for sure other factors like the level and scale of the rift (some can be singled for other you'll need a group) and random dice for blue and purple tokens (because they're limited per rift event).
tl;nr: Don't fail in the unstable stages and tank, heal, buff,, do damge as much as you can.