Next time you go to a Shakespeare play, don’t think you can settle back into a safe invisibility when the lights go down. You will be under observation: the actors we watch are in turn watching us, examining our personal flaws and the fault lines in our fractious society. We receive fair warning of the test that is in store. Hamlet invites a troupe of itinerant players to perform at Elsinore in the hope that they will embarrass and with luck incriminate his guilty uncle. Their purpose, he tells them, is to “hold, as ’twere, the mirror up to nature” and expose “the very age and body of the time”.

It’s our age and body, our manners and manias, that Shakespeare’s plays now probe, perhaps more pointedly than ever before. The film-maker Errol Morris, introducing American Dharma, his sulphurous documentary about Trump’s ideologue Steve Bannon, recently remarked that we are suffering through a period resembling “bad Shakespeare” – a mismanaged chaos that matches Horatio’s summary of the plot at the end of Hamlet, when he reflects on “accidental judgments, casual slaughters” and “purposes mistook”. History, while you’re living through it, doesn’t have the cyclical predictability discerned by Marxists; like Shakespeare’s plays, it is a melee of upsets and reversals, driven by capricious individuals whose actions seldom turn out as they are supposed to do.

Hamlet grudgingly accepts his role as heaven’s “scourge and minister”. Unable to rely on heaven, we look to Shakespeare as a contemporary conscience. Thus Nicholas Hytner’s production of Timon of Athens saw the bankrupt hero as a casualty of London’s slick, ruthless financial industry, and Rufus Norris earlier this year set Macbeth in an imminent apocalyptic future of gruesomeness and grunge, with nature replaced by a wilderness of plastic litter. Two moony adolescent lovers have been made to look like incendiary terrorists: Daniel Kramer, who directed Romeo and Juliet at the Globe in 2017, made it a critique of “the grotesquerie of capitalism”, with the rival clans as exemplars of “the new violence” who “pressed the detonator on this expensive society of branded merchandise”.

Shakespeare’s plays about feudal England have become a nightmare from which the present is trying to awake

Treachery and deceit are the stuff of theatre, which is where people adopt disguises and tell lies about themselves: is politics any different? Politicians have long used Shakespearean quotes to dignify their lust for office, or to tidy up the mess they have made. In 1978-9, with the Labour government mired in public-sector strikes, James Callaghan patronised the insurgent unionists by wearily referring to his “winter of discontent”: perhaps he didn’t realise that the phrase is uttered with venomous irony by Richard III, who remains a murderous malcontent. In the Thatcher era, Kenneth Baker and Nigel Lawson enlisted Shakespeare as a Tory by citing Ulysses’s sermon on degree from Troilus and Cressida and the diatribes Coriolanus addresses to the mob. Inconveniently, the first character is a time-serving opportunist, the second a rabid fascist; neither represents Shakespeare, who had no discernible political beliefs of his own and always bites back at those who misappropriate his words.

The royal family likewise fumbles when its members cosy up to Shakespeare. Queen Victoria often had the plays performed for her at Windsor; she concentrated on the antiquarian costumes the actors wore, which allowed her to overlook the fact that her predecessors in Shakespeare’s histories were killing off political rivals or dismembering the kingdom in order to wear a “hollow crown”. Elizabeth II has cannily kept her distance from Shakespeare. Invited to open the National Theatre’s premises on the South Bank in 1976, she let it be known that Hamlet, then in repertory with Alfred Finney, might tax her patience, and chose to attend an innocuous Italian farce instead.

The Queen’s heir is less cautious: what can the Prince of Wales do but play the king in a game of charades, since his entire life has been a rehearsal for an indefinitely postponed opening night? During the RSC’s celebration of Shakespeare’s fourth centenary in 2016, Prince Charles ambled on stage in Stratford and uttered the dramatist’s most famous line, “To be, or not to be – that is the question.” His abbreviated performance was both candid and deceptive – a glimpse of his own dithering ineffectuality, and an admission that royalty is primarily an acting role. Mike Bartlett’s satirical verse drama King Charles III, seen on television last year, imagines Charles’s future accession, with some authentically Shakespearean additions. According to Bartlett, the new king is secretly as regicidal as Richard III, while the Duchess of Cambridge in carving out a role for the next generation is closely akin to Lady Macbeth; Prince Harry, fated to follow his namesake Prince Hal in Henry IV, misbehaves with his mates in the pub, then callously deserts them so as not to forfeit his income from the civil list.

Shakespeare’s history plays about feudal England and republican Rome have become a nightmare from which the present is trying to awake. Tory plotters against the enfeebled Theresa May could be auditioning for the role of Richard III, who deftly kills his way to the crown. Meanwhile Donald Trump, according to his lawyer John Dowd, behaves like “an aggrieved Shakespearean king” – a petulant Richard II or a deranged Lear, astonished by the disrespect of his subjects. Trump also matches two of Shakespeare’s Romans – a would-be Julius Caesar with despotic longings, he is as titanically tetchy as Coriolanus, given to volleys of abuse that betray his mental instability.

When the director Rupert Goold planned his Richard III at London’s Almeida theatre in the summer of 2016, he fancied modelling Shakespeare’s most repellent villain on Boris Johnson. Both, Goold said, were “physically strange and yet sexually predatory, inherently comic, outside the rules, of questionable motives, ultimately ambitious”. Coincidentally, Johnson had signed a lucrative contract to write a biography of Shakespeare, which he shelved when he decided to rally Brexiters in the referendum campaign and ensure that England would revert to being Shakespeare’s “sceptred isle”, remaindered by history.

Goold eventually cast Ralph Fiennes as the crookback, so the prototype for the character switched to Johnson’s former ally Michael Gove, who during the Almeida run excused himself from the unseemly scramble to replace David Cameron. What Fiennes called Gove’s “protestations about ‘I could never lead, it’s not in my DNA to lead’” reminded him of the scene in which Richard bashfully pretends to decline the crown that a deputation of citizens begs him to accept. That, perhaps, was too kind a comparison. Richard in the play takes a risk whose dangerous effrontery we can only admire; Gove was simply squirming like a hypocritical weasel. The sequel to Shakespeare has now resumed, with Boris the lethal buffoon taking on the role of Richard III as he plots a putsch at Westminster.

In the heyday of American democracy, Walt Whitman argued that his countrymen were better off without Shakespeare, whose snooty aristocrats demeaned “the common people”. Since then, the idealistic young republic has swollen into a corrupt, venal empire, and it is currently lurching towards autocracy while splitting apart in a reactivated civil war. The relevance of Shakespeare’s squabbling English barons and his ethically compromised Romans can no longer be denied.

The week before the US presidential election in 2016, the director Ivo van Hove’s Kings of War – a compilation of Henry IV, Henry V and Richard III – travelled from Amsterdam to Brooklyn. Towards the end of the performance, the text switched from Dutch to English for a few seconds: after Richard III’s abrasive showdown with an obstinate sister-in-law who refuses to pimp for him, the actor Hans Kesting inserted an aside from Trump’s recent debate with Hillary Clinton, snarling “Such a nasty woman.” The audience’s delighted laughter didn’t alter the electoral outcome.

The following summer in New York, Oskar Eustis’s production of Julius Caesar at the Delacorte theatre in Central Park presented Rome’s narcissistic tyrant as an orange-maned vulgarian who rants on Twitter while cavorting in a gilded bathtub with his Slovenian trophy wife. Three words excerpted from Trump’s boast about fame and the immunity it confers were added to a speech describing the tyrant’s ever-loyal base: his fans would not mind, Casca declared, “if Caesar stabbed their mothers on Fifth Avenue”. Breitbart News decried the staging as an incitement to assassination, and at the performance I attended, rightwing protesters interrupted the showdown in the Capitol. The actors froze while police and security guards wrestled the invaders to the floor and hauled them away, after which Caesar recovered from his 33 gashes and died a second time.

Trump’s continuing legal tribulations have suggested other parallels. Condemning the decision of Trump’s fixer Michael Cohen to rat on his boss in a plea deal, Rudolph Giuliani, the president’s apologist, likened Cohen to Brutus delivering the coup de grace to Caesar. Context, however, is everything: Shakespeare’s Brutus is a man of principle who reluctantly resorts to violence because there is no other way of eliminating a menace to the state. Would anyone call Cohen “honourable” or “noble”?

In the play, Caesar’s ghost reappears to prophesy doom. As Trump frothed and raged during the prolonged obsequies for John McCain, while eulogies for the dead senator doubled as excoriations of the president, I cast McCain in the role of the retributive spectre. I hope he haunts Trump like the ghosts of Richard III’s victims, who queue up before his final battle and tell him to “Despair, and die.” The last act of a Shakespearean tragedy always brings such purgative reckonings. Life, however, lacks the moral efficiency of art: it remains to be seen whether poetic justice is confined to the theatre.

• Shakespeare: The Theatre of Our World by Peter Conrad, is published by Head of Zeus. To order a copy for £16.33 (RRP £18.99) go to guardianbookshop.com or call 0330 333 6846. Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99.