Learning to ground and center is essential to doing magickal work. It is something that those who rush into spellwork and then find their spellwork ineffective have often forgotten. Not only does it help with the practice of magick, it has many psychological benefits. When you need to calm yourself, or reconnect, or when your energy is flustered or scattered, taking the time to ground and center yourself can really make a difference. This is a quick practice that once you’re used to it may not even take a minute. I’m going to describe how I do it, then give some links to other resources to learn how to do it.

Take three deep, cleansing breaths. Breathe in your nose for a count of three, hold for four, breathe out your mouth for five. After that is done, just breathe slowly but normally.
Plant your feet firmly on the ground if they aren’t already and picture your feet like tree roots, like the picture above. Picture those roots running down, down into the ground, breaking through the soft dirt to the harder crust to the liquid magma and continuing to go down until they reach the center of the earth. When they get there picture them wrapping around the core of the earth. Picture the earth’s energy going up these roots to you, and your energy being connected to the earth by these roots.
Now picture a trunk rising from your back and spreading into branches that are going higher and higher in the sky and eventually piercing through to the universe. Picture some of the branches wrapping around the moon and others wrapping around the sun. Imagine the same exchange of energy you had with the earth. Continue to breathe normally through all of this.
You should feel calm and centered. If you start to feel hyped up or physically weird, just plant your feet firmer on the ground and picture yourself sending the excess energy back out of you, back to the earth and the sun and the moon. Tell them you don’t need any more for the time being. If you still feel off, touching your hands or your forehead to the ground, or even eating or drinking something helps with that.
I had a teacher who suggested doing this three times a day. It builds your connection with Nature and thus, the God and the Goddess, the source of the energy. It sounds complicated at first, but you will eventually get to where it feels very natural. But like anything else, it takes practice.
There are other methods for grounding and centering. Here are some suggestions.
Learn Religions.com Grounding, Centering and Shielding
About Meditation.com Grounding and Centering (another tree version, slightly different)
Ground and Center Meditation Wicca 101