Parenthetical expressions add comments or information. Because they often interrupt the flow of a sentence, they are usually set off with commas.
Transitions (such as as a result), conjunctive adverbs (such as however), and other expressions used to connect parts of sentences are usually set off with commas.