The Confederacy lost the Civil War for a variety of reasons, chief among them a lack of resources and manpower. The North had more soldiers, more manufacturing and agricultural capacity, and the ability to blockade Southern ports. The institution of slavery also made it difficult to generate political support overseas.
At the beginning of the war, the North had 22 million citizens while the South only had around 9 million, including 3.5 million slaves. The Union states also produced more than 90 percent of the country's iron and firearms. Early in the conflict, the Union established a blockade around the Confederacy, preventing the South from being able to trade for resources it sorely needed.
The Union also enjoyed an advantage when it came to leadership. While individual generals were notoriously incompetent in the first few years of the war, Lincoln was a strong leader compared to Davis. The Confederate government did a poor job managing the economy, leading to massive inflation. Escaping or liberated slaves bled the Confederate agricultural system while fortifying the Union. Lee's inability to bring the war to Northern states also meant that the South was almost always fighting on the defensive and suffering the ravages of the conflict.