What does it mean that Hashem "investigates the heart and tests kidneys"?
Radak, Malbim (from Vayikra Rabah 44): The kidneys counsel, and the heart decides. Lev Eliyahu (Bereishis p.124) - Hashem tests and sees when one leans to a Midah.
Beis Kelm (Emunah v'Midos, p.253): Hashem sees small matters, according to which He judges all deeds.
Why is it written k'Darko, and we pronounce it ki'Derachav?
Radak #1: It is written singular, based on the Klal, and we pronounce it plural, based on individuals.
Radak #2: Also the writing refers to the plural, just the Yud is omitted.
Why does it say "ki'Fri Ma'alalav"?
Malbim: I pay according to the internal ways of his Nefesh, and according to the deeds that result from the nature of his Nefesh. Deeds may appear good - I weigh according to the Nefesh, if his trust is from the depth of the Nefesh and his heart is complete and his Nefesh desires (the good).