Over at Chandrakantha there was recently a discussion about the best way to attach the main top strings to their pegs. Sooner or later you will need to replace a string, whether you snap one or they just get old and dull.
It is quite an easy process to replace the top strings. This photo from Rain City Music shows the best way to attach the string to the peg.
This will give a secure and tight grip on the peg, ensuring that the string does not slip.
At the other end you need to create a little loop to attach to behind the bridge. To do this, wrap the string around your finger (or pencil) so that it creates a 'U' shape, going back in the direction it's coming from. Then turn the small end of the string around the main line and repeat this five or six times. You need to make sure the turns are tight against each other, which can take a bit of practice, in order to create a firm hold.
Once you have done this, attach the loop to the little riser at the bottom of the sitar and start turning the peg, ensuring that the string is running along where it should and crossing the bridge in the correct slot. You may need to pull the string a few times and then re-tighten it as it will take a while for the tension to even out in the various places across the instrument. The string can take a while to become stable and stay in tune because the string can stretch and the tension on the coils on the peg can take a while to even out unless you wind it on with a good even force pulling on the string.
The taraf strings can be a bit fiddly to change as they are tied on to the peg inside the neck, but the principal is pretty much the same. Run the string under the frets and feed it in to the appropriate hole. You should have a little tool to hook the string and pull it out of the peg slot but if you don't then just use what you can, a coat hanger with a little hook bent in to the end should work. Then tie the string on to the peg and push the peg in. Then wind up the string - at this point it might help to pull the string vertically away from the next to create an even tension along the peg when you wind it up.
BuckinghamMusic.com has a great diagram for this:
Try to be patient when replacing strings, it can be very frustrating that they keep going out of tune but if you keep tugging them and then retuning they should stabilize after a day or so.