Summarize this article:

It's different for every dye, so it's hard to be specific here but most carpet dyes require you to mix them with hot water and a chemical. Mix the dye according to manufacturer's suggestions. You won't want to wear your nice khakis or your favorite dress. The odds are pretty high that you will get some of the dye on your clothing. You'll also want to wear protective eyewear, and maybe gloves. The corner might be a good spot for this, or some part of the carpet that normally rests under the table. Test it and give it a few hours to dry, because the immediate color might not be the same color once it is no longer wet. The manufacturer should have a listed drying time. If you're happy with the result, you can continue dying your carpet. Proceed with your decision to dye your carpet only if there are no adverse effects to the look or feel of the carpet and you are happy with the color. Start the dye application in the furthest corner of the room and continue working your way towards your exit door so you do not have to step on the wet dye. Many manufacturers want you to spray the dye onto the carpet. This is easy enough, all you'll have to do is take an empty sprayer that you have lying around and pour the dye into it. Be careful not to spill the dye - pouring it into a cup first and then into the sprayer might work better. An empty Windex sprayer or something of that nature will work. Scrub the dye into the fibers of the carpet after spraying it on. Use a stiff bristled brush and work in a circular motion. Take your time to ensure that all carpet fibers are evenly covered when you look at them from all angles. If you scrub carpet - the fibers will untwist. Raking with a carpet rake in a single direction is the only way to agitate dyes and not harm the fibers. Keep children and animals out of the room and give your carpet ample time to dry. The dye manufacturer should have an estimated drying time, and it's always safe to wait a little longer after that. Hopefully your carpet will look great!

Summary:
Follow the instructions on the dye package to prepare the dye. Wear the correct clothing. Test the dye on your carpet in an inconspicuous area before beginning the job. Apply the dye to the carpet. Let it dry.