Baby Gender

What can you do to find out the baby gender early? And if it's testing.. Do you just ask your doctor for it? Or do they just ask if you want it?