The (Almost) Impossible Chessboard Problem
If you don't have a useful strategy and your friend just has to guess, you clearly have one chance in 64 to go free. A simple improvement is to choose one square, say the upper left, and agree that if that coin is heads, the key is under a head. If it's tails, the key is under a tail. You, the flipper, can control that coin so this strategy gives you (about) 1 chance in 32.
Can you do better? Indeed you can. In fact there's a strategy that will guarantee your freedom. When I first saw this, it seemed impossible. You can only change one coin and yet when your friend comes into the room and sees a haphazard arrangement of heads and tails, he can find the key 100% of the time.
If you don't have a math or computer science background, it is very difficult to find the optimal strategy. But if you and a partner learn the strategy, you can amaze your friends at parties (if we ever have parties again).
To learn the strategy (which will require some effort), click here. To practice solving the puzzle, click on the Play link above. You will act as the first prisoner (the flipper) and the computer will act as your friend.