Here's an example:
"I've been racking my brains all day trying to remember where I put my keys."
The phrase is a metaphor, drawing on the image of "racking" (stretching, straining) a physical object, like a rack. In this context, the "rack" refers to the mind, suggesting that you are pushing your mental capacity to its limit.