When used in medical research studies, the phrase intent to treat refers to a type of study design where scientists analyze the results of their study based on what the patients were told to do, or how they were supposed to be treated, rather than what actually happened. For example, if a person in a study is randomized to a medical treatment but ends up getting surgery -- or no treatment at all -- their outcomes are still considered as part of the medical treatment group. In an ideal world, of course, intent to treat and actual treatment would be the same, but in the real world it varies a lot depending on the nature of what is being studied.
Intent to treat models are used for a number of reasons. The biggest one is that from a practical standpoint, they simply make sense. Scientists want to know how drugs or treatments will work in the real world -- and in the real world, not everyone takes drugs as prescribed or ends up getting the surgery they are recommended. By using an intent to treat model, scientists can analyze how a treatment works in a realistic context -- which explicitly acknowledges the fact that how drugs work in the lab may have very little to do with how they work in the field.
Not all people like intent to treat trials, however, because they can underestimate a medication's potential effectiveness. For example, early trials of pre-exposure prophylaxis for HIV in gay men showed that the treatment seemed relatively effective... but only in individuals who took it regularly. The overall results were a lot less encouraging. While some people would say that a drug doesn't work if patients won't take it, others would say that you can't judge a medication if patients aren't taking it as prescribed.
Sometimes scientists who initially design a study for intent-to-treat analysis will end up analyzing the treatment both that way and per-protocol (i.e. comparing people who actually received the treatment as specified to those who did not, regardless of randomization.) This is usually done when the intent-to-treat analysis shows no effect, or no significant effect, but some effect is seen for the people who actually took the treatment. However, this type of selective, post-hoc analysis is frowned on by statisticians and may provide misleading results.
When an intent to treat study is less promising than earlier, more closely observed studies, scientists will often ask why -- in an attempt to salvage what had been considered to be a promising treatment. If it turns out, for example, that people weren't taking a medication because it tastes bad, that problem may be easily fixable. However, sometimes results in smaller trials simply can't be duplicated in a larger study, and doctors are never entirely sure of the reason why.