West Asian Numbers
The earliest way of writing down numbers was to carve notches in tally sticks, and this method spread from Africa all over Europe and Asia. But by about 9000 BC, people in West Asia began to use a different method of counting. Instead of tally sticks, people made clay tokens in different shapes. The shapes meant different types of things. So a little clay ball might mean a sheep, while a clay pyramid might mean a pig. In this way, you could count different things, and another person who saw the tokens would know what you meant - three balls and four pyramids would mean three sheep and four pigs. Probably the reason that people wanted a new way of counting at this time is related to the beginnings of farming and keeping animals at about the same time. People used these tokens all over West Asia, from India to East Africa and Greece.
By about 4000 BC, people came up with an even better idea, combining tally sticks and tokens - how about making grooves on the tokens themselves? Then the tokens could mean more complicated things like "female goat" or "male goat", or "best olive oil" and "cheap olive oil".
Bulla and counting tokens
But suppose you were sending your slave to bring the olive oil to your business partner in another village? You could send along the right number of tokens with your oil, but what if the slave stole some of the oil, and just threw away that token? Soon farmers and merchants began to seal up the tokens so that the slave could not throw them away. This is one way to do it - string the tokens like beads on a necklace, and then seal up the necklace with a lump of clay. To keep the slave from breaking off the clay, throwing away a token, and putting on new lump, you can use a seal to mark the lump of clay.
Another method of preventing theft was to seal up your tokens inside a clay ball. Again, you could mark your seal on the outside of the ball. The only way to throw away a token would be to break the clay ball. But on the other hand, once the tokens were inside nobody could count them without breaking the clay ball. What if somebody wanted to check the shipment along the way? So people began pressing the tokens into the clay before sealing up the ball. That way you could know what tokens were inside.
Then people thought, "Why am I making all these little tokens? Why not just carve *pictures* of the tokens into a ball of clay, stamp my seal on it, and forget the tokens altogether?" That's what they did, and by 3500 BC or so, we have the beginnings of cuneiform writing in West Asia, and of hieroglyphs in Egypt, and of pictograph writing in India.
Science in Ancient Mesopotamia, by Carol Moss (1999). Easy reading. On the short side.