The number 666 is in roman numerals, "DCLXVI", which stands for "Domitianus Caesar Legatos Xti Violenter Interfecit", meaning "Domitianus Caesar vilely killed the envoys of Christ". The original number, however, found in the oldest versions of the text, have the number 616, "DCXVI", wich takes the word "Legatus" out and leaves "Domitianus Caesar vilely killed Christ". The presence different numbers in different texts show that the copyists didn't care so much about the number but its meaning, remembered the later and not exactly the former and thus changed it by error from 616 to 666.
Now, how's Domitianus Caesar? Could be Nero, who was born under the name Lucius Domitius Ahenobarbus (changed his name when Claudius adopted him as a successor), or it could be emperor Domitian, who also persecuted Christians. Given the years of their reigns, both Nero and Domitian are contemporary to Saint John. It could be ambiguous on purpose to refer to both. In any case, when you read Revelation 13, it becomes apparent the beast is a powerful governor, who the people adore as a god, who's autocratic and unopposed. The second beast that comes kills everyone who refuses to adore the effigy of the first one (much like Christians were persecuted cause they refused to adore the emperors as gods). And there's also: "And he [the second beast] shall make all, both little and great, rich and poor, freemen and bondmen, to have a character in their right hand, or on their foreheads. And that no man might buy or sell, but he that hath the character, or the name of the beast, or the number of his name." (Revelations 13:16-17). Those who do not think (forehead) or act (right hand) as the governor wants see themselves excluded from public life and society, much like Christians of the time. There's also the fact that the beasts serve the Dragon (Satan), come in succession (like a dynasty) and come after Christ, whose coming appears in Revelation 12.
>How literally should we take the mark of the beast?
As a number? Non literally. The beast is not gonna carry a sign saying "Hey, I'm the servant of Satan, come join me in eternal damnation!". The beast is an earthly power, is the autocratic state who people worship as if it was a god, is the dictatorial governor who turns people away from Christ. The followers of the beasts carry the mark in their thoughts and in their actions, not in their physical foreheads and hands. The two beasts are the tow kind of evil governors that can arise: the first beast is a mixture of aggressive predatory animals and directly wages war against he followers of Christ, and the second beast has features of a lamb, but the voice of a dragon, and has different methods. It establishes a culture and a religion around the previous beast tricking the inhabitants of Earth into abandoning Christ.
"Here is wisdom. He that hath understanding, let him count the number of the beast; for it is the number of a man: and his number is Six hundred and sixty and six." (Revelation 13:18). True Christians (who have understanding) will recognize the beast.