It's not pretty. They press down on either side of the vent to expose part of the inside. Males will have a small lump that females don't have (or I could have got that backwards). This is done on the first day after hatch, by people who have had extensive training. 90% accuracy is the most common claim, but you can imagine how many mistakes a newbie would make! They don't vent sex bantams, too small and fragile. There are videos out there showing the technique, but I would worry about hurting a chick so I've never been tempted to try it.
I've only read a little about primary feather sexing. There are some breeds for which this works, but only if the trait is diligently maintained by careful breeding (ie, not in the big hatcheries). It has to be checked in the first few days after hatch, and you look at the emerging primaries. One sex has longer feathers, or one sex has feathers of differing lengths on the wing. Again, can't remember exactly how it works. I imagine there are lots of birds out there that might have this trait, but without consistent breeding, it's probably not that reliable.