These usually take a comma when they’re at the beginning of a sentence but not when they’re at the end.
If I go to the store, I need to take my wallet.
I need to take my wallet if I go to the store.
A few butterflies sunned themselves but then disappeared when it began to rain. (No comma between themselves and but!)
“No, I don’t need any milk,” I said as I looked in the refrigerator. (Please don’t put a comma between said and as… :-))
After reading the note, Henrietta turned pale.
Henrietta turned pale after reading the note.
You can find more examples in Chicago Manual of Style 6.36. There are also examples in The Blue Book of Grammar, Grammar Girl’s Quick and Dirty Tips for Better Writing, and most other punctuation books and style guides.