One of the things that could happen is that one string of your guitar breaks or that they are so old and dirt (for example for the sweat of your hand) that they may not sound so well and may need to be replaced (even for hygiene). If it's possible (because strings are not very bad), avoid changing all of them at the same time because when you put new strings, it's necessary to tune them more than once till they become stable. That's why is better to change the three low strings of the guitar (the 3 strings at the top), then some days latter the 2nd and 3rd string and then the first string (the one below) that is the higher (in sound) and thinnest so it's more difficult to tune. Therefore this way (changing only some strings and wait they get stable to change the others) prevents having to tune all the strings of the guitar at the same time (that it's more difficult to do).How to remove the broken or old strings
In all types of guitars the first thing to do is to loosen the pegs (in the pegbox at the end of the guitar's neck) of the old or broken strings till you can pull of it and take it out of the peg.
Once we take the string out of the peg we have to take them out from the bridge (in the guitar's body). Untie the knot of the string in classical guitars, in the acoustic guitars there are some plastic terminals which you have to take them out. And in the electric guitars stick the string in the bridge and take it out from the back side of the guitar although not in all electric guitars strings come out like this, sometimes they do from the front part right from the bridge.Types of strings
There is a type of strings for each kind of guitar. In classical guitars, the three strings with the highest sounds are made of nylon and the other three (the ones with the lowest sounds) are made of nylon fabric coated with steel or metal spiral wire. All acoustic guitars strings are made of metal. This difference of materials gives each guitar a specific sound. Some people have put acoustic guitar strings in a classical guitar. It's not good to do it, strings are completely different and the acoustic's have much more tension so the classical guitar bridge could be damaged. Electric and acoustic guitar's strings, although they are different, have a round stopper in one of the ends. The bridge and the way to place the strings is also different.To put a string in a classical guitar
We start placing the strings (in classical and all types of guitars) in the bridge in the guitar's body. In classical guitars we introduce each string in each hole in the bridge and make an especial knot. The 3 lower strings have the "simple knot" that consists on intruducing the string in the hole, then passing the string behind itself (at the other side of the hole) and passing underneath itself near the hole. That way when you pull the string is caught in a knot.
The other 3 strings, the higher ones, use to have the same knot but when passing the string behind itself (at the other side of the hole) is better to tangle it 2 or 3 times with itself as a plait and then continue passing underneath itself near the hole as the lower strings. An additional knot could be made at the string's edge before placing the strings, as a stop (green arrows).
Then stick the string in the appropiate hole in the pegbox and take it out from the other side. Tangle it with itself as a plait and start to turn the peg. That way the string is tangled in the peg and remains placed.To put a string in an acoustic guitar
To change the acoustic guitar strings, firstly loosen the pegs and take out the old strings from the peg box (at the end of the guitar's neck) as mentioned before. In the acoustic guitars bridge (in the body of the guitar) there are some plastic terminals which you only have to take them out but always after loosing and taking out the other end of the string from the peg box. These terminals are placed by pressing on them, sometimes are very tight and its necessary to use some little pliers to take them out very carefully not to damage the guitar. When taking out one of these plastic terminals you may see that the part that is usually inside the bridge has a groove in which goes the new string with its round edge just below the end of the plastic terminal.
Then you have to put the plastic terminal with the string in the groove inside the hole of the bridge and press it strongly. Finally the string is placed in the peg box like the electric guitars: inserting the other end of the string in the little hole that the peg has, pulling on the string to tighten and turning the peg till the string is tuned. You may cut with the pliers what is leftover of the string once it's placed in the peg box.
-A tip: if you are placing the terminal with the new string and you notice that the wood shrank a bit (due the summer dryness or a heater) and now when tighten the string to tune it comes off, dip the terminal (or terminals) in a glass of water and wet with a spray or cloth the hole where the terminal goes, but carefully not to wet the rest of the guitar. Then put the terminal with the string in the hole but don't tune it yet, just place it so the string receives all the humidity and inflates a bit. You may wet a bit more the area with the terminal placed. Wait a while so the wood inflates and then you can tighten the string to tune it.To put a string in a electric guitar
Introduce the string by the end that has not the stopper, in the appropriate hole generally in the electric guitar's back side and take it out by the bridge in the front side of the guitar. Then pull on the string till the round stopper gets in the guitar's body and doesn't allow you to pull more. Finally insert the string in the little hole that the peg has, pull on the string and start to turn the peg till the string is in tune. When placing the first or second strings in the peg box, since they are the thinnest, is better not to pull entirely and give a bit of looseness before start turning the peg because the string could bend too much and break. If it's the first or second string, being the thinnest is better not to pull entirely and give a bit of looseness before start turning the peg because the string could bend too much and break. You can cut with pliers what is leftover once the string is placed.
There are some special designed models of electric guitars that have a floating bridge. In most of them strings are placed in the bridge in another way: you need to cut the round edge of the string with some pliers, then insert the string in a hole in the bridge and tighten a screw with an Allen key. It's possible that some in floating bridges, strings may be put with the edge, just the entire string: just check if you can see if the other strings of your floating bridge guitar have the round edge.
It's always better not to change all the strings very especially in electric guitars with floating bridge since it will get out of tune so much, it's better to change some and wait several days when they have "stabilized".To put a string in a bass guitar
In bass guitars, the strings are set in the same way but it's not so probable that one of those strings break, although it's necessary to change them from time to time. Learn more about types of guitars that exist.Tips and tricks.
In classical guitars sometimes you can even see that the string is wearing down in a certain place. If you don't have an extra string, and as a last solution, you can "turn arround" the string and place the end that was in the pegbox of the neck in the bridge of the body of the guitar and vice versa. That avoids that the string breaks in that place that was wearing down and extends a bit its useful life. You can only do that with the strings of classical guitars because both ends are the same and they don't have that round edge in one of the ends like happens with the electric and acoustic guitar strings.
That's why when you put new strings in your guitar, it's better not to cut the excess of the string at the pegbox once the string is placed and leave at least a bit leftover. Sometimes, strings can break just in the white piece in the bridge (in the body of the guitar under the strings where they are tied). That happens when you play loud and hit the strings too hard with the right hand (specially with a pick). If a string breaks right there it's a sign that you need to play softer. Other times when you put the three low strings of the guitar (the 3 strings at the top) being rough and not slip off at the time that you tighten up the string (with the peg) and could break there: you must supervise that the string slips off when you tighten it with the peg, otherwise try to move it a little bit with your fingers. The fact is that if you don't cut all the leftover of the string (like many people does) and leave a little bit, you can use the same string if it breaks at bridge high since it still would be long enough.
If you have an old classical guitar and the pegs of the Pegbox are rusted and go hard is good if you put them just a little cooking oil using a tissue paper so they can move better, otherwise they can break. If a peb breaks you need to change the entire set of three pegs for three strings (its like this in the Classical guitars). These set of pegs are sold in many places but sometimes is complicated to find exactly the same model of pegs to match with the other set of pegs (of the other three strings).
If one of the pegs is broken you can take out the string in this end (is not necesary to take it out from the other end in the bridge of the body of the guitar) you can loose the screw of the wheel of the peg and replace that peg without having to remove the entire set. Otherwise you have to remove the three strings and take the set of three pegs removing its little fixation screws and replace the entire set of three pegs. Once that you have tighten the fixation srews you nedd to put the strings and tune the guitar. If you loose some of these little screws you can find them in a hardware store. You may be interested to know other care that your guitar needs.More recommendations:
There is a new didactic page in this site about tonality. In this website you can have all the information about Miguel Angel González Aguado like for example his 30 years long history of concerts, the guitar lessons that he offers in Madrid and online from any part of the World, his academic degrees from Conservatoire and University and the places where you can buy his records.