Weapons which cannot have sockets (like throwing weapons) won't get any socket and those with a maximum of 1 socket (like a few daggers and wands) have no chance for two of them. This results in a magical, socketed weapon that can be rerolled again with chipped, normal or flawless gems as many times as desired.
This doesn't add sockets to the existing weapon though, since it is rolling new mods on the weapon, so is essentially random. The only partial exception is the 3 chipped gems + 1 magical weapon recipe, which will create a magical weapon with new properties and 1-2 sockets.
You can never add a socket to an item that already has one or more sockets, with any recipe or the socketing quest reward. Also items can generate with a variable number of sockets, and how many depends on the monster that drops them, the item type, and much more. There are three Cube recipes to add them, as well as the socket quest in Act V. Socketed Items can be complicated, mainly in the number of sockets and how to add sockets to existing items. 6 How to Obtain Socketed/Socketable Items.