As bummzack pointed out below, the odds for getting a certain amount of slots via recipe isn't always equally distributed.
However, if you have a white item (armor or weapon with no sockets in it), you can add a random amount of sockets to it via Horadric Cube recipes. Once an item has sockets, you can not add additional sockets, or remove any. Most colored items only give 1 socket, although blue (magic) items will randomly give 1 or 2 sockets. If you add sockets to a colored item this way, you will get fewer sockets. The number of sockets added is based on the specific item you're adding sockets to (it will always get the maximum for an item of that type).
You can give white items to Larzuk in Act 5 once per difficulty as a quest reward in order to have him add sockets to the item. An item with sockets has exactly that many sockets forever, and it cannot be altered.