Here's what works for me when painting.
The easiest (and the most boring) way to make a painted room look great is to paint it all one color, but if you'd like to attempt painting the ceiling a different color than the walls (or trim) - I have a few tricks that will help you.
The most important thing is to mask. Mask the trim and the ceiling. I use the wider tape to mask where the wall and ceiling meet.
I like to paint the walls first, so I mask off the ceiling right next to the wall. If you've done this before and you have a textured ceiling, you know that the wall color will seep under the tape and you'll get an uneven edge even though you went to all the trouble of masking it.
It's also tough to get a tight seal with your tape on the baseboards. Make sure to wipe them down with a wet rag to get the dust off first. Get your tape lines as straight as you can.
Just take some of the ceiling color (which is usually a lighter color than the walls) and with a brush paint right on top of the tape next to the wall. This will seal the edge of your tape and prevent the wall color from seeping under it. Do the same thing with your trim color; paint it over the top of the tape, right where the wall and trim meet.
Let it dry, and then paint your walls. Later, when you're ready to paint the ceiling do the same process in reverse. Tape off the walls, run some wall color over the tape where it meets the ceiling, let it dry, paint, let it dry (very important), peel off the tape and voila! perfect straight lines. Well, at least as straight as you taped them.
This also works great on orange peel textured walls and bullnose corners when you want to have a crisp line between colors.
For other tips, stop by Rocks in my Dryer or see some of my past tips: