Go to your local music store and purchase the single string that is broken; the strings from the thickest to the thinnest are: E, A, D, G, B, E.
Remove the broken guitar string by pulling the bottom half out from the bridge of the guitar or from the holes in the back of your guitar, depending on what model you have. Unwind the top half from off of the tuning peg at the top of your guitar so that the entire string is removed.
Clean along the bare fretboard, where the removed string was with a clean cloth to remove any built-up dirt.
Take the new string out of its packet and unwind it. Feed the top end--that is, the sharp pure string end, not the end with the metal ball--through the hole in your bridge or the hole in the back of your guitar. Pull the wire up the neck and pull it around the peg from the inside outward. Twist the string around the peg a couple of times, then insert the end through the hole in the tuning peg.
Start tightening the string using the tuning peg. Make sure that as the sting tightens it rests in its respective groove on the headnut.
Tune the string into its proper pitch using a tuner. Once it is in tune, stretch the string a few times by holding a fret with one hand and pulling on the string. Repeat this a number of times--stretching then re-tuning.
Cut the excess string from the tuning pegs after you have stretched the string using wire clippers.