It detects the oxygenation of blood. The mechanism behind this is a different magnetic moment of oxygenated hemoglobin, oxygenated hemoglobin is diamagnetic vs paramagnetic while deoxygenated. This is called the BOLD effect (Blood Oxygen Level Dependent). The difference in the two conditions magnetic property affects the MRI signal lifetime in the near vicinity. This results in contrast developing between tissues with oxygenated blood vs tissue with deoxygenated blood. The idea behind fMRI is that when you use a certain part of the brain, it requires oxygenated blood, which will lead to contrast. Unfortunately, due to low overall signal strength/contrast-to-noise ratio, the image must be signal averaged. Hence if you were tapping your finger to see which part of your brain "lights up", you would have to repeat this action, and have your MRI scan be synced to your action so that the same part of the brian is being imaged over the same interval each time. It's tricky, but my understanding is that it's quite feasible. There are many other mechanisms for causing localized signal lifetime changes, without having RTFA, I can't be sure what they took under consideration.