First, decide on the medium you wish to use. Traditionally, that is paper, but if you are proficient as a touch typist a computer keyboard and screen may be used. Next, clean your mind; for that purpose, a period of meditation in a distraction-free room beforehand may be helpful. Decide on which spirit or entity you wish to contact/channel. It could be a departed loved one, an angel, or your higher self. Then put pen to paper (or hands on keyboard) and close your eyes! This is to enhance the connection between your subconscious brain and your hands. While keeping your mind clear, allow your hands to do whatever they want to do. You then may be conscious of your hands writing, typing, or even drawing. Continue this practice for as long as it feels comfortable; this may be a few minutes, or as long as a half hour or more.
What you produce if on paper may initially be lines, shapes, or gibberish but don't worry about this at first, and likewise don't be concerned with grammar or spelling. Your writing won't likely be neat. Don't be discouraged! Automatic writing may be conducted as a spiritual practice, and some recommend keeping a journal in which you record your reactions or trends and meanings in your writings that you see. Over time, you may find yourself getting better at the practice, and your results becoming more revealing. Results will vary from person to person. Good luck in your efforts!