He studied ancient democracies to find out about how other republics and governments worked and how many of them failed.
He thought there should be one central government called a Federal Government and that there should be 3 branches in that government:
Legislative
Executive
Judicial
In these branches no person would have more power. It was a way of balancing the government.
In the Articles of the Confederation there was no cental power and the sates could write their own laws and do as they wanted. Under a central government it would make a set of laws that would control the other governments
THe constitutional convention of 1787 was to make a basic form of laws that would govern the people and the states
Madison showed how the Delaration only gave power to elect congress, which only had two powers to declare war and declare peace. There was not and central government and that they had no powers over the states.
The Constitution would set up laws that and how new laws were to be made. The delegates from each state helped in the wording of the Constitution and with the three branches it was a way to have a system that would not let a branch have too much power like a king.