The War of 1812, as its name suggests, began in 1812. A peace treaty was signed in December of 1814, but with the slow communications of that time, British forces in the United States did not learn of the treaty until much later. This meant that there was one major battle fought in the US in 1815. So, you could say that the war lasted from 1812 until either 1814 or 1815.
The War of 1812 came about because the Americans were unhappy about things that the British were doing. They were unhappy about British forts on American soil. They were particularly unhappy about the British practice of stopping American ships and impressing sailors from those ships. In general, they felt that the British did not respect American sovereignty and independence. For this reason, the US declared war on Britain in June of 1812.
The war was not a terribly bloody war and neither side really defeated the other. The most famous incidents in the war came when the British attacked Washington, D.C. and burned the US Capitol and when the US, led by Andrew Jackson, defeated the British at the Battle of New Orleans in early 1815.