The burning of DC was in retaliation for the American burning to the ground of York (the old name for Toronto.)
And the US failed in its primary objective, to conquer Canada. The stuff about protesting impressment of US sailors was merely a convenient excuse; the maritime states of New England that had the sailors being taken were OPPOSED to the war, while Western states supported it. The majority of the members of congress who voted for the war voted for it for the primary reason of capturing Canada.
All that most people know about the war comes from high school history textbooks, which are pretty crappy and sanitized.