To rack one’s brain is to think very hard, usually to remember something or to come up with the answer to a problem. This is a harmless, diluted version of the word “rack”. Its original meaning was associated with anguish. This dates back to the infamous medieval torture device known, obviously, as the rack. Some ingenious sadist decided it would be a swell idea to tie someone onto a rectangular device, usually made of wood, with rollers at the ends. You would tie the person’s hands and feet to the rollers. Then you would turn the rollers, stretching the poor fellow to get him to tell you what you wanted to hear. Occasionally, the person doing the turning would get a bit carried away, and would pull off a limb. In fact, this scenario is thought to be the first use of the phrase “my bad”.
In an interesting side note, there is a story that an enterprising entrepreneur tried to resurrect the rack in the 1980’s as a way of adding a few inches to your height. With a sleek, futuristic design and push-button ignition, the machine was a marvel of modern engineering. However, despite its obvious appeal, it was simply too expensive to mass-market. It seems people weren’t willing to pay an arm and a leg for a little vertical enhancement.