Everyone who does anything with magic needs to know how to center and ground.. It's like stretching before a sports event. Centering will help you keep yourself balanced and focused on what you are doing. Grounding keeps you from getting "spacy"or distracted.
You should always ground before you do anything with any magic or ritual work. As well, if you do it before you sleep you'll not only sleep better, you might remember more from your dreams as well. Grounding and centering aren't just for magical uses, either. Grounding will help you to meditate better. Centering can help you with public speaking, taking exams, performing, and managing anger.
When you're first learning this, get yourself somewhere where you're very comfortable, and if you're not quite settled anywhere, make yourself as comfortable as possible wherever you can. After a while you can do it anywhere, because it becomes second nature.
Close your eyes, and place your feet firmly on the ground or floor. Gather all the energy in your body to a nice round glowing ball in what you feel is the center of your body. This is centering. Find a center point in yourself and feel it there, steady and calm. If you are only centering and not moving on to grounding, maintain this as long as you need to until you feel you have centered yourself enough.
Center yourself first. Breathe deeply. As you breathe in, feel the clean, fresh air filling your whole body, filling your Self. As you breathe slowly out, feel the worries and problems of your everyday life, your mundane existence dropping away, through your feet into the Earth. Now imagine that ball slowly putting down a thick taproot, small at first, getting thicker, through the base of your spine, down into your feet. Feel that root get thicker as it goes down through layers of soil and rock, pushing deep into the Earth.
Imagine the water table under all those layers of earth, and when your root reaches the water, draw the cool, fresh energy of the Earth flow up to your centered energy ball and blend with it - the Earth Power is a deep well, and you are drawing it up into yourself, through your chakras, up your spine and through the top of your head. Feel the Earth Power fill you, rise through you like refreshing water, and feel it flow through your Center, constantly providing both new energy and a route for negative and unhealthy energy to flow away, carried by the Earth Power back to the depths of the living well to be cleansed and made useful again.
As the energy flows through the top of your head, feel it branch out, spreading like the arms of a tree. Feel it grow to the sky, into the stars, and touch the bright Sky Power pulsing overhead. As it pulses, draw it down through your branches, down through those arms and into your center, to connect with your Center, to join there in union and balance with the Earth Power. Feel the cool breezes of the Sky Power invigorate and cleanse you, bringing inspiration and joy from the vast Universe into your Center.
Now you are connected to the Earth Power, and the Sky Power; feel them join together in a balance in your Center, and in your Self. You are grounded now in all things, and may journey deeper in to other realms; this is the beginning of a meditative state, the state in which the mind is ready for both magical work and ritual.