I'll try to do this as easily as I can. Say you have an item with 2 sockets, one red and one blue. This means that you can put two gems into it. They do not have to be the same colour as the socket, but if you want the socket bonus, you will have to match them. Socket bonus' are not required, but if they are good, you can try for them. To socket, just shift right click the item and drag the gem into the the socket you want it in. Just to be clear, the gem does not have to be the same colour as the socket to go in it, with the exception of meta gems, which only fit in meta gem slots and they are only on some head pieces. Gems are aquired by having a jewelcrafter cut them from a raw gem. A bright living ruby would have to be cut from a living ruby and so forth. So basically, choose what gems you want in your leggings, buy/aquire them and then shiftright click the leggings and socket them where you want them.
I hope that was clear.