Generally, Torah ink (דיו, in Hebrew, like dye) is what's called an iron gall ink. Iron gall inks have been used in a great many places during a great many periods in history. They last a long, long time (think Dead Sea Scrolls kind of longevity). They have an unusual property among pigments in that they form chemical bonds with the parchment, which makes them symbolically very appropriate for use on Torahs. They are lightfast, the ingredients are cheap, and they are very indelible.
I don't make my own; making good ink is hard, and I don't have anyone willing to share their recipe. Anyway, it's supposedly rather a pain, so I buy it in bottles, as shown. I don't know if it's also available in cake form - cake is much easier to transport, of course, and lasts longer, and is entirely traditional. I suspect perhaps not, because I have a feeling that buying ink like this is kind of For Dummies, and real hardcorers, the kind who would want cake ink, probably do make their own.
As you might expect, there are hundreds of different recipes for this kind of ink. However, they have some things in common, viz.: gallnuts, iron (II) in solution, something runny, and something sticky. The following descriptions are indebted to an excellent article by Cyntia Karnes.
Gall nuts
See the Wikipedia entry, but basically gallnuts (also called oak-apples) are a sort of arboreal tumour. A gall wasp comes along and lays its egg on the tree, and the tree goes "whoa" and swells up around the egg, into this little hard ball. The larva sits inside the swelling, munching away, and when it grows up it eats its way out and leaves the ball on the tree.
The balls have to be turned into a gloopy solution. This basically involves grinding, dissolving, and fermenting, and there are about a zillion ways of accomplishing this. Depending how it's done, what you end up with is a liquid containing tannic acid, gallotannic acid, or gallic acid.
Iron (II) sulphate
This is where the iron comes from. It tends to be known as copperas, or coppervasser if you are the Mishnah Berurah, because iron sulphate and copper sulphate tended to come out of the ground together, but the copper isn't important and the iron is.
This is why some recipes call for boiling up nails with the gallnuts. In an acidic solution, you get the right sorts of reactions. It's apparently quite dangerous if you do it properly.
This is where the iron comes from. It tends to be known as copperas, or coppervasser if you are the Mishnah Berurah, because iron sulphate and copper sulphate tended to come out of the ground together, but the copper isn't important and the iron is.
This is why some recipes call for boiling up nails with the gallnuts. In an acidic solution, you get the right sorts of reactions. It's apparently quite dangerous if you do it properly.
Runny and sticky
Fairly obviously, ink needs to be runny, but it also needs to stick to the page. Gum arabic, the sap of certain sorts of acacia tree, dried, ground, and dissolved in water, is commonly used as a binder in all sorts of things - ink, paint, food - and has been for centuries. It stops the ink being too runny, and helps stick it to the parchment when it dries.
Runny can be distilled water, but it can also be wine (including idolatrous wine, isn't that interesting?) or vinegar, or presumably most other sorts of liquids. Vinegar helps to make the ink shiny, I am told (the gum arabic goes on shiny, and the vinegar helps keep it shiny, something like that), and indeed one of the shiniest brands of ink out there smells very vinegary indeed.
Chemistry
This is the fun bit. You mix all these things up, apply them to parchment, and let the oxygen in the air do its thing. It's incredibly complicated and I don't understand it all, but basically what goes on is: the gallotannic acid bit reacts with the parchment; part of it grabs onto the parchment, and part of it floats about. The floaty bit reacts with that iron solution, and iron (II) oxide gets precipitated. Iron (II) oxide is black.
Iron-gall ink made like this is pale grey in colour, and it gets darker when these reactions have had time to happen - about a day, I understand, but I've not tried it.
Incidentally, iron (II) oxide isn't terribly stable, and over time it tends to turn into iron (III) oxide. This is the same stuff rust is made of, and it's red. This is why letters in old Torahs go brown or orangey-red, as the black iron (II) compound oxidises to the red iron (III) one. They're just starting to go brown in the picture here.
Soot
For whatever reason, the inks I buy have had stuff added to them so that they are black when they go on, and presumably they get blacker with oxygen, but not so's you notice. I think this is soot - burnt olive oil is referenced in one source, or just burnt wood. They say specifically you mayn't use burnt ivory (ivory-black), since elephants aren't kosher.
Non-iron-gall inks
The rule is that the ink has to be black and permanent, and for the longest time the way to make permanent black ink that would work on a scroll (wouldn't fall off when rolled) was like this. However, these days we have all manner of funky synthetic blacks that are entirely lightfast and suitably adherent and flexible. Can we use those?
The discussion then takes one of two approaches.
a) The sources talk about using the ingredients for iron-gall ink, so this must be part of what kosher ink is, and to use kosher ink is a requirement from Sinai.
b) That is by way of description, it's true that in those days they couldn't make good ink without iron galls etc. But the point is that the ink be indelible and black; synthetics accomplish this just as well, and there are times when they're a better tool, in some ways.
Interestingly, the right of the denominational spectrum seem to be more okay with b) than the left. The left-tending and the ultra-right frequently share a visceral aversion to b) and insist on a) only. Happily, it's not really an issue with brand-new Torahs, where you don't need synthetics for anything.
To finish, here's the Keset ha-Sofer, the scribes' handbook, on basic laws pertaining to ink.
Fairly obviously, ink needs to be runny, but it also needs to stick to the page. Gum arabic, the sap of certain sorts of acacia tree, dried, ground, and dissolved in water, is commonly used as a binder in all sorts of things - ink, paint, food - and has been for centuries. It stops the ink being too runny, and helps stick it to the parchment when it dries.
Runny can be distilled water, but it can also be wine (including idolatrous wine, isn't that interesting?) or vinegar, or presumably most other sorts of liquids. Vinegar helps to make the ink shiny, I am told (the gum arabic goes on shiny, and the vinegar helps keep it shiny, something like that), and indeed one of the shiniest brands of ink out there smells very vinegary indeed.
Chemistry
This is the fun bit. You mix all these things up, apply them to parchment, and let the oxygen in the air do its thing. It's incredibly complicated and I don't understand it all, but basically what goes on is: the gallotannic acid bit reacts with the parchment; part of it grabs onto the parchment, and part of it floats about. The floaty bit reacts with that iron solution, and iron (II) oxide gets precipitated. Iron (II) oxide is black.
Iron-gall ink made like this is pale grey in colour, and it gets darker when these reactions have had time to happen - about a day, I understand, but I've not tried it.
Incidentally, iron (II) oxide isn't terribly stable, and over time it tends to turn into iron (III) oxide. This is the same stuff rust is made of, and it's red. This is why letters in old Torahs go brown or orangey-red, as the black iron (II) compound oxidises to the red iron (III) one. They're just starting to go brown in the picture here.
Soot
For whatever reason, the inks I buy have had stuff added to them so that they are black when they go on, and presumably they get blacker with oxygen, but not so's you notice. I think this is soot - burnt olive oil is referenced in one source, or just burnt wood. They say specifically you mayn't use burnt ivory (ivory-black), since elephants aren't kosher.
Non-iron-gall inks
The rule is that the ink has to be black and permanent, and for the longest time the way to make permanent black ink that would work on a scroll (wouldn't fall off when rolled) was like this. However, these days we have all manner of funky synthetic blacks that are entirely lightfast and suitably adherent and flexible. Can we use those?
The discussion then takes one of two approaches.
a) The sources talk about using the ingredients for iron-gall ink, so this must be part of what kosher ink is, and to use kosher ink is a requirement from Sinai.
b) That is by way of description, it's true that in those days they couldn't make good ink without iron galls etc. But the point is that the ink be indelible and black; synthetics accomplish this just as well, and there are times when they're a better tool, in some ways.
Interestingly, the right of the denominational spectrum seem to be more okay with b) than the left. The left-tending and the ultra-right frequently share a visceral aversion to b) and insist on a) only. Happily, it's not really an issue with brand-new Torahs, where you don't need synthetics for anything.
To finish, here's the Keset ha-Sofer, the scribes' handbook, on basic laws pertaining to ink.