There are almost as many ways to case a doorway (or a window frame) as there are carpenters (to learn about a production approach to casing, read the article Perfect Miter Joints Every Time). But in all cases, the keys to success are making sure that the corners of the jamb are perfectly square, that your miter saw is cutting accurately, and that you assemble the miters carefully (get them right and tight) before nailing the rest of the casing.
To permit the casing to lie flat, the jambs should be flush with, or slightly proud of, the wall surface. Plane the jambs if they’re too far out; extend them with thin strips of wood if they’re too far in. If the drywall is proud of the jamb by 1/8 in. or less, knock it back with a hammer.
If you have only one or two doors to case, a 16-oz. hammer and a nailset will get the job done just as quickly as an air nailer.