In Clark Gregg's own words, as told to BuzzFeed:
"In the original script of Iron Man, I'm not even sure his name is Coulson — I think it was just 'Agent.' And then he had a name, and seven or eight lines. And then all of a sudden, there's a scene at the end where Pepper Potts and Tony Stark are saying 'Thank you, Agent Coulson.'"
"As a fan of the comics, I nearly died on the spot."
"And then I got to say 'Strategic Homeland Intervention Enforcement and Logistics Division' — and I knew what that was! And that's amazing. I can cross that one off my bucket list. I am going to go to geek heaven for that."
"And then they brought him back and gave him a couple great lines in Iron Man 2."
"And then at the end of one of those scenes, they said, 'Oh, tell them you're going to New Mexico.' I did a couple of takes, and I said, 'Uh, what's in New Mexico?'"
"And they went, 'Oh god, has no one talked to you? You have a big part in Thor!'"
"I thought, 'This is crazy! This doesn't happen.'"
"For Avengers, I thought I'm going to walk through and give somebody a milkshake and keep going while all these movie stars get the stuff to do."
"Marvel said, 'Listen, great news. We're sending you the script, and you really have a big part.' I said, 'That's great. Joss told me that. I'm really excited' — still skeptical. They said, 'Yeah, what happens to you is what brings them together!' There was just a long silence on the phone. I said, 'Oh. Oh no. Really? Is this my last Marvel movie, boys?' They were like, 'Well, you've burned so bright and so well.' I saw the script and I was thrilled. If that's how he goes out, magnificent. It was a very emotional day. I had really been moved by the way fans responded to him and recognized that he was kind of like the geek who won the S.H.I.E.L.D. golden ticket. Maybe a bit more of a bad-ass version. I said good-bye to it and was really sad."
"And then they said, 'We're in a lot of meetings where people are talking about how to bring back Coulson! We're not going to tell you how, but it's not impossible.'"
"Again, everyone says that, and you don't come back. And then I got this call saying, 'We'd like to send you something!' When I saw they had really amazing idea for why I might still be around in a post-Avengers world, it was just one more step in waiting for somebody to step out and say that I'm being punk'd. And then we were shooting the pilot."