I've had sex while drunk. I've also had sex with a drunk guy or two while I was also drunk. In some states, it is illegal to have sex with someone who is drunk. I don't know if it is still illegal if you are also drunk. For all I know, I may have committed a crime. I honestly couldn't tell you.
The problem with combining alcohol with sex is that consent becomes a blurred line, and a blurred consent, or a slurred consent, isn't really consent at all. It would seem that if your state of mind leaves you incapable of signing a legal document, then you're very likely in no condition to give informed consent.
This actually seems to be a bit of a controversial subject, probably because most of us are guilty of it in some way, shape, or form, and none of us really want to admit to being guilty of something which could legally be construed as rape in a court of law. Consider how many people go home with someone whom they met in a bar, and then have a one-night stand.
I know that when I have had sex while drunk, I wanted to beforehand, and the alcohol just gave me that uninhibited ability to say what was on my mind, and that's what got me into the bedroom with him. Neither one of us later regretted it. But what if we had? Could we accuse one another of having raped each other? I don't know. I'm no lawyer. But I think this is also where part of the controversy comes in. What if both parties are drunk? Who is at fault then? Is anyone? Are they both?
Generally, I'd say that having sex with someone who is inebriated in any way, be it alcohol or drugs of some sort, is a bad idea. It may seem like they are game when you get together and do your thing, but when they sober up, they may realize that they have done something which they wish they hadn't, and now you're screwed.
I remember chatting with a guy on Grindr once a while back. He and I had chatted before and it was always just simple chat. We may have talked about sex, but we didn't really discuss having sex with one another. We were just talking. It was fairly apparent, though never actually said, that he was not into me. That's fine. I don't care that much. This time, however, there was some talk of perhaps fooling around. My interest was piqued. But then he disclosed that he was drunk and probably shouldn't because he knew that if he was sober, he wouldn't be interested. That was somewhat insulting to hear, but I gave him a pass because he was drunk. More importantly, though, his disclosure and his moment of clarity and candor may have prevented us both from making a mistake which we would have regretted later.
I don't know how often people who had seemingly consensual sex while drunk and later realized that they didn't actually want to, but in their inebriated state had gone with the flow, and later pressed charges against the person with whom they had sex. I rarely, if ever hear of it happening. But that doesn't mean that it doesn't happen.
It's kind of scary to think that this actually is rape, and it really is, but this makes you wonder how well you can tell if someone is sober. What if you don't know that the hookup you're with is under the influence of something? What if they're high on meth, and since you don't know them all that well, and maybe you're not familiar with how someone behaves while they're tweaking, you are inadvertently breaking the law and violating this person. It's scary to think about.
My best advice is, if you realize that your soon-to-be sex partner is drunk or high, do not engage in any for of sexual activity. None. Politely tell them you'll be happy to fuck their brains out when they sober up, but for now, you'll have to pass. As an added benefit, it's much more fun to have sex with someone who has their wits about them. With a drunk person, you risk them vomiting on you, or being unable to obtain or maintain an erection, or you risk them being unable to achieve an orgasm. You also avoid them potentially passing out on you mid-coitus.
In short: Fuck sober people.