There were a number of differences between North and South that helped the North win.
One was the fact that the presence of slavery in the South made it harder for the South to get support from Europe. England might have supported the South because of cotton, but there was also a lot of anti-slavery sentiment in England that made it hard for their government to really side with the South.
Second, the South wanted a strong system of states' rights, which was a major reason for seceding. This made it very hard for them to finance the war. The central government had a hard time taxing, which hurt the CSA's war effort.
Perhaps most importantly, the South had an agricultural slave economy while the North had a free and somewhat industrialized economy. This meant the North could make more of what it needed (like guns) and therefore had a major advantage.