The easiest question to answer is why did the south lose. The union had almost every economic and technological advantage compared to the south. This was due to the industrialized economy of the north. The north had a significant manpower advantage as well, despite some of the early and embarrassing loses (such as Bull Run). As time went on, the union could take advantage of various developments (metallic cartridges/repeating arms, mass produced weaponry, etc.) on top of their numerical superiority.
While the south had high quality leadership (particularly evident early in the war), they had a decentralized command structure (each state being somewhat autonomous), and their manpower issues forced them to pick and choose battles. The confederate armies had to move and maneuver considerably to avoid confrontations with the union until such a time that they could engage on their own terms. Over time, they simply lost this advantage due to attrition. As the union took more territory, controlled the major rivers, and controlled the railroads, the confederates could be more easily isolated and cornered..
Economically, the south simply did not have the resources to fight a conventional war. They were under a fairly effective blockade, and were not well endowed in terms of metallic resources nor industry. Over time, they simply could not fuel a war with a cash-crop economy hamstrung by sanctions and blockades.