When is it necessary to do two coats of paint over a primer?
You should add another coat if you don't think it looks good enough. If you think it looks good with one coat, don't put on a second. 

In more concrete terms, you generally add another coat if the color or finish is not even. That may come with one coat, or it may take two, three, or even more. It depends on the surface, the primer, the paint, any existing finish, technique, thickness of the coat of paint,  etc. 

Covering up dark colors with light colors generally requires more coats, but a good primer can reduce the number of coats of paint needed. Using a tinted primer generally means fewer coats are needed.