I finally figured out how it was supposed to be done when I started going for manicures. If you look at how manicurists paint nails, you'll find that they have a certain technique that ensures a neat coat of polish every time.
The 10 steps to follow for perfect nails every time:
Start off with a clean nail.
Apply a base coat and let it dry.
Place a drop of polish at the center of the nail, a bit above the cuticle.
Push the drop towards the cuticle, leaving just a small gap.
Move the brush upwards, making a straight line till the end of the nail.
Go back to the base of the nail and swipe the polish along the curve of the nail.
Keep dragging the polish until the whole side of the nail is covered.
Repeat step 6 on the other side of the nail.
Repeat step 7 on the other side of the nail.
Apply a second or third coat if you want more opaque coverage. Finish with a top coat.
This video by Miss Jen Fabulous also gives a clearer picture of how you should be painting your nails:
My tips for on how to paint nails perfectly:
The trick is to get just the right amount of polish on the brush. What I do is brush the polish brush on the side of the bottle neck a few times to get excess nail polish off. The amount of polish in your brush should be just enough for you to paint one or two straight drags.
Don't start from the cuticle base but just a little above it (like in the diagram), so that the nail polish doesn't pool at the base but is evenly spread out.
Use even less nail polish when you're painting the curves of your nail (step 6). That's where it's harder to control your strokes and this means polish pools and smudges more easily.
Practice makes perfect, so if at first you don't get you'll get better, neater nails as long as you keep trying. If you still get the errant bits of nail polish on the skin around your nails, some nail polish remover and cotton buds will do the trick.