As I write this, almost 99% of the returns are in and Makey leads by 10.2% (54.9/44.7). As basically universally expected, Markey has won by a decent margin (though not great for a Democrat in Massachusetts). The basic explanation is this: Gomez, though a good and likeable candidate, was significantly outgunned both financially and organizationally, and could not overcome the partisan lean of a state so Democratic it only gave Republicans 51% of the vote in near-perfect conditions not replicated here. The next questions to ask are: 1) How did I do?, and 2) What now?
Like many in the prognostication business, I put solid predictions down in writing (at the link, go down to the last entry under 'Massachusetts (2013 special)'). I personally predicted Markey to win by 9-15 points. The actual result is on the low end of that, but still in the range. My prediction model (if you're new here, I suggest you read that) expected a Markey win of just under 14 points - not so good. So, why did it overestimate Markey's margin by almost 4 points (Note: from here on I will presume you have read that page explaining what the model is. Last chance to do so.)?
The easiest first target is a couple polls in the average that were clear outliers - one from New England College and one from U Mass Lowell and the Boston Herald. Both put Markey's lead at 20 points. Those two polls accounted for about 17% of the total average. Just getting rid of them moves the predicted margin down to 12.2% - still about 2 points off. One of them also provided net favorability numbers for both candidates, but these weren't much of an outlier and kicking them out knocks the predicted margin down by less than .1%. Reducing the margin given by the intangibles (the most fallible part of the model) brings the error down to about 1.5%. Removing weight from intangibles to favorability reduces it a bit more to about 1.3%.
Now the second question: what next? Gomez has said he might run again, though, as I've said before, if he couldn't beat Markey now he most likely can't in 2014. His showing, while decent, probably precludes future NRSC support (and, in my opinion, should). With a plethora of cheaper and easier targets (and those which would be much safer if captured) I doubt the national party would be willing to much support a semi-quixotic bid for a seat they'd have to perpetually fight tooth-and-nail for. Should Gomez run again, he would probably keep it fairly close, but not enough to have much of a chance of winning. If Scott Brown decides to run (which I consider pretty unlikely) he would make it competitive, but I expect it would still be advantage Markey. Any other Republican and Markey should face little trouble, barring yet another good Republican candidate popping up out of nowhere a la Brown and Gomez.
As for Gomez' future: he performed respectably enough to make him a top contender for other offices should he decide to run for them. I suspect Republicans would heavily recruit him for the open gubernatorial race, particularly if Scott Brown declines. A future race for the House or some lower statewide office probably isn't out of the question. My particular preference, though I see little indication of it happening, would be for Gomez to join a ticket with Brown as LG nominee, a power ticket that might even be advantaged against any Democrat.