Specifically, I want to look at how magic in the Harry Potter universe resembles and reflects the practice of mindfulness.
1) Verbal Spell-Casting
It's not enough to learn the words and wand movements for a spell to work. It's a rare feat indeed for any student to successfully cast a spell the first time they attempt it. No, to make a spell work you have to:
a) Concentrate - Harry has difficulty learning the Summoning Charm in Book 4 because he keeps getting distracted from the spell by thoughts about dragons. To make a spell work, your whole focus and attention must be on the specific spell you're casting. Similarly, the single most important ingredient for mindfulness is focus and attention in and on the present moment.
b) Visualize - Spells require the caster to visualize the desired outcome. Indeed, the words and wand movements for many spells are a bit vague. Take Riddikulus, the spell used to banish dark creatures called boggarts, learned in Book 3. From the Latin for joke or laugh, the word Riddikulus does not specify what the caster wants to happen. Instead, the caster has to vividly visualize their greatest fear (which the boggart has turned itself into) taking on an amusing form. The visualization, combined with casting the spell, forces the boggart into the amusing form, which causes laughter, which in turn finally banishes the boggart. A way of focusing one's attention, visualization can also be part of mindfulness - for example, visualizing one's thoughts as clouds floating past in the sky can help to foster a degree of detachment.
c) Intent - One's magic can sense ambivalence or hesitation, and the spell won't work. For example, in Book 5, when Harry tries unsuccessfully to cast the Cruciatus (torture) Curse against the woman who killed his Godfather, she says: "Never used an Unforgivable Curse before, have you, boy? You have to mean them, Potter! You need to really want to cause pain." Now, pain is not the object of mindfulness, but it does help to have a clear intent - and ambivalence or reluctance can short-circuit the whole process.2) The Patronus Charm
A special case of verbal spell is the Patronus Charm, which conjures a silvery phantom form from the positive thoughts of the caster; once conjured, the form can serve as a protector or messenger. As we learn in Book 3, to successfully cast the charm, the caster must call up a memory associated with intense positive emotions - that involves vividly visualizing the memory including the emotion associated with it. Similarly, mindfulness may center around a specific emotion, while also bringing to mind the related thoughts, sensations, and experiences.
3) Non-Verbal Spell-Casting
As we learn in Book 6, casting a spell non-verbally requires a similar mental process to verbal spells, only more so: since no words are being spoken, the mind and will of the caster must be singularly concentrated on the intent and process of casting. The mind must hold the incantation (i.e., the words), the caster's intent, and the visualization of the desired outcome. Getting stuck in any one element (just the words or just the outcome, for example) will cause the spell to fail. In mindfulness, one is also working to simultaneously hold in one's mind the various aspects of experience: thoughts, emotions, and sensations.
A special case of non-verbal spell is Apparition - the practice of disappearing from one place and reappearing in another. Also learned in Book 6, Apparition requires that you: "Fix your mind firmly upon the desired destination," "focus your determination to occupy the visualized space! Let your yearning to enter it flood from your mind to every particle of your body!" and "Turn on the spot, feeling your way into nothingness, moving with deliberation!" This is pure mindfulness - focusing all of one's attention on the present moment cognitively (destination), emotionally (determination), and physically (deliberation).
Another special case of non-verbal magic is occlumency, the art of sealing one's mind against external magical intrusion or influence. We learn about it (although Harry is unsuccessful in learning it) in Book 5. The key to occlumency is clearing one's mind of whatever one does not want an intruder to access - especially intense emotion. This is very similar to mindfulness, which shares the goal of detachment from intense emotion, or any other single aspect of experience, instead allowing all of one's experience to flow past one's mind as one metaphorically steps back and observes it.
I'm sure there are other ways Harry Potter elucidates the practice of mindfulness - I've written enough for now, but feel free to add to my list! Hopefully this offers an illustration of the acts of the mind that are part of mindfulness - awareness, focus, will, intent, detachment.