How did physicists know that there are two kind of charges?
Get together a collection of charges. As many different ways to generate a charge as you can think of. Go ahead and invite your friends so they can think of some more. (As a practical matter you make static charges just before you use them, but still...)
Now, test them pair wise to see if they attract or repel one-another. Keep careful records.
Find the largest set that are all mutually attractive and the largest set that are all mutually repulsive.
You'll find that the attractive set has exactly two members (though you can make many different examples of this set) and the repulsive set consists of half (either half!) the charges you've created.
Ponder that for a while. It also gives you the answer to how like charges respond to one another (though you can get that directly by preparing two similar charges).
I agree with DanielSank that the question is asking (wholly, not partly) about the historical development of the concept of electrical charge, not our modern description of it - "how did they know?" not "how can we know?" The latter (answered by dmckee) is the end result of more than two centuries of observation, experiment, theorising and debate, and ignores theories which looked promising but were rejected. It uses hindsight which our ancestors did not have.
Your textbook describes the present day model of electric charge, and only alludes to the historical development of ideas. Compared with today, this was hampered by mysticism and superstition, and poor communication between the few people who had the resources to carry out scientific investigation.
Static electricity and magnetism were initially thought to be the same phenomenon. Both were known to the ancient Greeks (amber = 'elektron', black lodestones were abundant in Magnesia). They were 1st distinguished by William Gilbert around 1600 ('De Magnete' http://www.gutenberg.org/ebooks/33810). He described static electricity as a fluid released by rubbing, and classified materials as 'electrics' (those which could be electrified) and 'non-electrics' (those which could not). About 1620 Niccolo Cabeo discovered that electricity can repel as well as attract.
The first (static) electric generator was invented in 1660. In 1729 Stephen Gray discovered electrical conduction, re-classifying materials as conductors and non-conductors. In 1733 Charles Francois du Fay discovered that electricity comes in two forms which he called resinous (-) and vitreous (+). The Leyden Jar, the original capacitor, to store and release electrical charge, was invented in 1745. Benjamin Franklin's major achievement was to show that atmospheric electricity (lightning) and static electricity generated in the laboratory, are the same phenomenon.
Du Fay's report of "two kinds of electrical fluid" was published in Philosophical Transactions in 1733. In it he stated the law that "like charges repel, opposites attract." He showed that all bodies, both solids and liquids, could be electrified. His classification of the electricity itself, rather than the materials which can produce or conduct it, was a breakthrough idea in the understanding of electricity.
http://rstl.royalsocietypublishing.org/content/38/427-435/258.full.pdf+html?sid=c8642e49-7dd2-488e-b815-f031c1bb6afb
Franklin's findings and ideas were published as Experiments and Observations on Electricity (1751). His single fluid model rivalled the two fluid models of Du Fay and Abbe Jean-Antoine Nollet. He explained one fluid (negative) as the absence of the other fluid (positive). He coined several electrical terms which we still use today, including charge, conductor, plus, minus, positively, negatively. https://archive.org/details/experimentsobser00fran
I think you are correct. There do not seem to be many histories of ideas in electricity and magnetism. One possibility (probably available only in major libraries) is :
A History of Electricity: (The Intellectual Rise in Electricity) from Antiquity to the Days of Benjamin Franklin
Park Benjamin, J. Wiley & Sons, 1898 - 605 pages
There are some good answers here, but I think I want to try to abstract Franklin's work a little bit. Because Franklin found just two options - "repel" and "attract", he was forced to consider only two kinds of charges.
Consider the experiment, where glass-glass repels, plastic-plastic repels, and glass-plastic attracts. If all glass is the same, the glass must be creating the same kind of charge (call it, "glass charge"). Plastic obviously has another kind of charge (since it repels). so plastic has "Plastic charge". The rule for "charges" is that "like charges repel", and "unlike charges attract".
So we don't get told the rest of the story, but presumably he did this with many other materials, and found that some repelled, and some attracted. He could have labeled them all different and added more rules (metal charges, wood charges, water charges, etc), but if you have only two results ("attract" and "repel"), each pair of objects can only do one of those two things.
So he could have tried triples of objects, to see if this was only a binary effect, but because there are only two (electric) charges in nature, he would have found that out. And of course, if he had worried about the size of the effect, he might have worked out many different kinds of charges ("plastic charges" being much bigger then "wood charges", but probably smaller then "metal charges"), but since he was looking at binary data, he was forced to only consider binary answers.