How to Ground Yourself to Avoid Destroying a Computer with Electrostatic Discharge
To ground yourself and avoid destroying a computer, take steps to prevent the build-up of electrostatic discharge around your computer. For example, try to assemble or take apart your computer on a hard surface while standing on a floor without carpets. You should also work in bare feet, which helps to cut down on the static discharged through your body. Additionally, ground yourself by touching an unpainted metal piece of your computer's case with your while you're installing a component. Alternatively, buy an anti-static wristband and wear it as you work.
Work on a hard surface. Assemble or take apart computers on a clean, hard surface to minimize static buildup. A table, countertop, or a plank of wood will work fine. Your computer should never be placed on a surface such as carpet, a blanket, or a towel when performing any action that requires you to ground yourself. Stand on a hard floor in bare feet. Carpets and socks can give you a charge. Stand in bare feet on wood, tile, or other hard floors instead. If you don't have the option of not standing on carpet, you'll need to be especially proactive about grounding yourself once every couple of minutes. You can wear rubber slippers to completely block your connection to the floor, but this is excessive for home projects. Any shoe with rubber soles should also be enough to block your connection to the floor. Take off all static-friendly clothing. Wool and some synthetic fabrics are especially good at gathering static, so remove these if possible and replace them with cotton clothing. If possible, wash and dry your clothes using a dryer sheet to minimize static build-up before working on your computer. Humidify in dry weather. Static electricity is a much bigger risk in dry environments. Run a humidifier if you happen to have one, but don't bother buying one if not. The other precautions should be more than enough on their own. You can also humidify by hanging wet cloth in front of a radiator or fan. Keep all components in antistatic bags. All new computer components should stay in the antistatic bags they were sold in until ready for installation. Understand how grounding works. In order to prevent built-up static from transferring from you to a sensitive computer component, you'll need to discharge the static into something more durable. In most cases, this is a metal item that is either touching the floor or touching a series of items leading to the floor. Use your computer's case to ground yourself. The majority of builders use this technique: before touching or installing something that can be harmed by ESD (e.g., the motherboard), place your hand on an unpainted metal piece of the computer's case. You can even lay your non-dominant arm on the metal part of the case while installing the component if you want to be absolutely positive that ESD won't harm it. Touch grounded metal objects every couple of minutes. This must be unpainted metal with a clear ground path, such as a metal radiator or the bay shielding on your computer's case. This is the quick and easy option, and many people build computers without taking any other precautions. There's a small but definite risk that this will not be enough. Rely on this only if your project is quick and the components are not valuable. Ground yourself with an anti-static wristband. These cheap items are sold at electronics stores and in online markets. Wear the wristband tight against your skin, and clip the dangling end onto a grounded, unpainted metal object such as a screw. Do not use a wireless wristband, as these do not work. If you get a wristband with a loop (rather than a clip), it's easy to slip it over the center screw on a wall outlet plate. This is supposed to be grounded (at least in US code), but you may want to double-check with a multimeter. Connect yourself to a grounded metal object via a wire. A common technique for keeping oneself grounded is tying a conductive wire, such as copper, around one's toe or wrist and then tying the other end around a grounded, unpainted metal object. This is ideal if you have the materials on-hand and don't have a way to work on a hard surface. Work on an ESD mat. Buy an ESD mat rated for "conductive" or "dissipative", then place the computer parts on the ESD mat and touch the mat as you work. Some models will have a place to clip your wristband onto as well. Go with a vinyl ESD mat for computer repair; rubber is more expensive and not necessary for this purpose. Unless you value your peace of mind highly, this is above and beyond for most home projects. 
Work on a hard surface. Stand on a hard floor in bare feet. Take off all static-friendly clothing. Humidify in dry weather. Keep all components in antistatic bags. Understand how grounding works. Use your computer's case to ground yourself. Touch grounded metal objects every couple of minutes. Ground yourself with an anti-static wristband. Connect yourself to a grounded metal object via a wire. Work on an ESD mat. 