1) First pour the glass as to avoid foam as much as possible, this will make is so you don't have to wait too long until you have to drink it.
2) If the beer is nice and cold then give it a couple minutes to warm up. Though everyone loves their beer cold (at least cheaper beers) it is much harder to chug a really cold beer, and can give you a painful brain freeze. Too warm is bad though too, it will taste terrible and will make a lot of gas while you drink it.
3) Once the beer is foam free and not too cold but still not too warm yet it is optimal to drink. This is pretty intuitive on the technique. Grab the glass, put it to your lips and tilt the glass up. The best way to drink it is to try and swallow just before the beer hits your throat, this way your throat will already be open and the beer will just continue its flow as it goes. Once you master this the only thing to do it just work to keep your throat open as long as possible, some people can do it for the entire glass, others have to take 2 big swallows to do it all, the idea is to learn to do it in one.
There you have successfully chugged a beer nice and fast. While the glass method is much faster, it is not nearly as convenient as the can so just do what you want and enjoy your time drinking. But enjoy intelligently, don't chug yourself to an Emergency Room.