Unrequited Love

I have a question for everyone. Have you ever experienced unrequited love? What are you supposed to do about it?
I'm curious because at the moment, I think I'm in love with someone who for sure won't love me back. Let's call him D, for the sake of the explanation. I started talking to D about a month after I met him. I was making paper stars and he bragged that he could do it too. From this, we began hanging out and I was integrated into his group of friends, some of whom I already knew. I thought that I was starting to like him. I wasn't sure, but I felt really comfortable with him and seeing him made me happy.
When I asked D if he had a girlfriend, he said no. Then one of my classmates asked if he had ever had one. D said no at first, then he was like, "Well, I kinda had one a long time ago." Not really all that suspicious, but it did make me wonder about the story behind that. I didn't ask, because I didn't want to seem nosy.
Then a month or so later, D and I go to a school event with a bunch of our friends. He seemed reluctant to hang out with me, and said that he had to wait in line with his other friend. I said I didn't mind. Later that evening, I saw D and another guy holding hands. I asked my friend what was up with that. My friend said "They're dating. Didn't you know?" I was surprised, but kinda dubious, since the friend I asked usually joked around. I asked another friend and she confirmed it. I was totally in shock because he had said that he didn't have a girlfriend. Then all the evasive answers started to make sense. He didn't have a girlfriend; he had a boyfriend.
That happened maybe a month and a half ago. After that event, D stopped sitting at my lunch table and he started spending more time with his boyfriend. At least it seemed that way to me. It could have been that I just never noticed it before. Now whenever I see the two of them, I'm really jealous and I honestly feel a pang in my chest. It also destroys my mood in a nanosecond. These signs are telling me that I still like him, but I'm pretty sure that I don't have a chance with him.
So I need your help. What am I supposed to do? It's hard to just give up, and I don't think he knows that I like him. He may have guessed, since I know I'm not the best at hiding my thoughts.
Also, the two of them are definitely having problems in their relationship. Yesterday, D came back from a two-day absence with red-eyes, and a depressed mood. When I confronted him, he said he was sick. I pressed further and said that his mood couldn't just be sickness; there had to be something more to it. He conceded and said that there was more, but then he refused to say anything else.
Basically, I'd like advice on how to handle this. And sharing your experiences is welcome too. Why are the nicest boys always gay or taken, or both?

LynLyn

End