After this, seeing that Alyattes would not give up the Scythians when Kyaxares demanded them, there had arisen war between the Lydians and the Medes lasting five years; in which years the Medes often discomfited the Lydians and the Lydians often discomfited the Medes (and among others they fought also a battle by night): and as they still carried on the war with equally balanced fortune, in the sixth year a battle took place in which it happened, when the fight had begun, that suddenly the day became night. And this change of the day Thales the Milesian had foretold to the Ionians laying down as a limit this very year in which the change took place. The Lydians however and the Medes, when they saw that it had become night instead of day, ceased from their fighting and were much more eager both of them that peace should be made between them. And they who brought about the peace between them were Syennesis the Kilikian and Labynetos the Babylonian: these were they who urged also the taking of the oath by them, and they brought about an interchange of marriages; for they decided that Alyattes should give his daughter Aryenis to Astyages the son of Kyaxares, seeing that without the compulsion of a strong tie agreements are apt not to hold strongly together. Now these nations observe the same ceremonies in taking oaths as the Hellenes, and in addition to them they make incision into the skin of their arms, and then lick up the blood each of the other.
The eclipse predicted by Thales occurred on May 28, 585 BC. Diogenes Laertius says in the Lives:
According to other statements, he is said to have been the first who studied astronomy, and who foretold the eclipses and motions of the sun, as Eudemus relates in his history of the discoveries made in astronomy; on which account Xenophanes and Herodotus praise him greatly; and Heraclitus and Democritus confirm this statement.
Thales was by all accounts pretty competent in the astronomy of the day, but it's utterly unclear how he managed to predict the eclipse. Part of the difficulty is how precise the prediction is supposed to be; I am not enough of a Greek scholar to adjudicate, but I have seen interpretations of Herodotus according to which he is saying that Thales predicted the exact year, and the eclipse occurred within that limit, and others according to which he is saying that Thales predicated a limit, and the eclipse occurred in a year within the limit of the predicted range. The former seems the more common interpretation, and in that case it's possible that Thales just made a lucky guess: it isn't clear what method he could have used with the kind of data he would have had to predict a solar eclipse. Lunar eclipse would have been manageable, in principle, and some have argued that Herodotus is actually not saying that it was a solar eclipse; but this doesn't seem a popular view.
Patricia O'Grady has an interesting discussion in her IEP article on Thales.