This question already has an answer here:
In Nusach Ashkenaz (and I assume Nusach Sefard as well as other nuscha'ot), there is a "hymn" said as part of the Musaph service on both days of Rosh Hashanna and Yom Kippur that has a refrain וכל מאמינים (Everyone believes).
One of the phrases says: וכל מאמינים שהוא בוחן כליות
"Everyone believes that He (G-d) checks the kidneys"
I assume that the term בוחן כליות is a metaphor for "a person's intentions or thoughts". But, I am trying to get a sense that if that is what is meant, what is the connection of mentioning the kidneys and what does it mean to "check" or "investigate" them. Investigate what?