Siege engines have been around since ancient times. Battering rams were the earliest siege engine, which were developed by the Assyrians. The Spartans used battering rams in 429 B.C, but mostly the Greeks used only assault ladders to get over walls. Alexander the Great was a proponent of using siege engines. They greatly helped him in his quest for world domination. He used the ballista to attack small targets and light structures, as it did not have the power of the onager. This was in the 4th century B.C. The Romans mainly used siege towers to assault walls and put their people over them, however, they did invent the onager, a type of catapult.
Siege engines came into their own during the medieval period. They were a way to assault a walled city or castle without having to wait for the starvation of the people inside. There were basically 2 ways to take a city. You could starve it, which could take years depending on how much food was stored and if there was any food sources inside the walls, and if there was a water supply inside the walls. The other way was to use mechanical means to break down the city or castle walls.
During medieval times, there were many war machines used. Many of these were variations of catapults. There were the basic catapult, the onager from Rome, the mangonel, which was similar to the onager, and the ballista. The traction trebuchet was invented in China in the 3rd century, and brought to Europe in the 4th century. The counterweight trebuchet was a medieval invention of the 12th century. They also made use of battering rams and siege towers to use when assaulting castles and walls.
The trebuchet is a truly magnificent invention. They can be constructed on a very large scale, and can lob a projectile of over 350 pounds at a city very fast. The other advantage of the trebuchet was that they were more accurate than many other types of catapults. The trebuchet allowed you to target a specific section of wall or section of the inner city more accurately, instead of just lobbing stones randomly at it.
Most siege engines were constructed on site. You marched your army to where you were heading, and then you started chopping trees. There were vast forests in medieval times, as land was not cleared to the extent it is today. This way you only had to carry things like the rope and metal parts needed, and the bulk of the machine was made of wood cut on site.
Trebuchets were usually loaded with stones, either one large one or many smaller ones. Sometimes it was loaded with manure, or other disease causing agents. The trebuchet was so large, that they could launch infected or diseased animals, such as cows, and infected human corpses inside a city, thus causing disease and sickness to help them take the city. This was a primitive form of biological warfare.