You can cook them, but they are lovely raw. They taste mostly of oyster-flavoured seawater.
You open them with a strong knife through the hinge (or a special gadget) -- as TariqE says, easy to slip and hurt yourself. Then use another shell to loosen the oyster, and "drink" it out of the shell. Mmmmmm.
You can cook them too, and this is best if you are not absolutely certain about their freshness. I've never done it though -- poached gently, then served with a nice creamed sauce?
Bear in mind that raw is also live, so you may prefer to cook them anyway.