How does methylphenidate work for ADHD patient? What's the chemical reason in the brain?

Dopamine. It blocks the Dopamine reuptake (prevents the break down of dopamine) in the frontal lobe, which in turn increase Dopamine in the frontal lobe (executive center of the brain).
Reuptake inhibition. Methylphenidate inhibits the reuptake of norepinephrine & Dopamine in the post-synaptic neuron. This means it keeps these neurotransmitters around longer at a receiving nerve cell connection (synapse) to get their message across better. Any brain system using norepinephrine or Dopamine can be impacted, not just the ones we want. That's how side effects happen.
Further point. In theory the Dopamine increase also helps the "gating neurons" in the midbrain be more selective and screen out irrelevant signals.
Ritalin (methylphenidate) Stimulants work by blocking reuptake of chemicals that enhance attention, hence increasing their amounts in brain.