The poem begins:
When chapman billies leave the street,

And drouthy neibors, neibors, meet;

As market days are wearing late,

And folk begin to tak the gate,

While we sit bousing at the nappy,

An' getting fou and unco happy,

We think na on the lang Scots miles,

The mosses, waters, slaps and stiles,

That lie between us and our hame,

Where sits our sulky, sullen dame,

Gathering her brows like gathering storm,

Nursing her wrath to keep it warm.
After Burns has located us geographically:
(Auld Ayr, wham ne'er a town surpasses,

For honest men and bonnie lasses).
(a quote that gave Ayr United F.C. their nickname "the honest men"), Tam sits and drinks with his friends, and the reader is regaled with a dark prophecy of Tam's wife Kate:
She prophesied that late or soon,

Thou wad be found, deep drown'd in Doon,

Or catch'd wi' warlocks in the mirk,

By Alloway's auld, haunted kirk.
Tam's wife, Kate, is portrayed as an authority to be feared. Then:
Ah, gentle dames! it gars me greet,

To think how mony counsels sweet,

How mony lengthen'd, sage advices,

The husband frae the wife despises!
Tam continues to drink and even flirts with the landlady of the pub. Eventually he mounts up and rides off on his grey mare Meg, for his long, dark, lonely ride home. Burns emphasises the spooky character of the Ayrshire countryside Tam has to ride throughâbut of course it is much easier as he is drunk:
Inspiring bold John Barleycorn!

What dangers thou canst make us scorn!

Wi' tippenny, we fear nae evil;

Wi' usquabae, we'll face the devil!
With the scene set, suddenly: "wow! Tam saw an unco sight!"
The sight he sees is Alloway Kirk, ablaze with light, where a weird hallucinatory dance involving witches and warlocks, open coffins and even the Devil himself is in full swing. The scene is told with grimly enthusiastic gothic attention to detail. Tam manages to watch silently until, the dancing witches having cast off most of their clothes, he is beguiled by one particularly comely female witch, Nannie, whose shirt (cutty-sark) is too small for her. He cannot help shouting out in passion:
Weel done, Cutty-sark!
And in an instant all was dark:
The devil decides to follow Tam, but the evident pride in the ability of his horse is justified as she is able to help him to "win the key-stone o' the brig". (The Devil, witches and warlocks cannot cross running water.)
They only just make it though, as Nannie, first among the "hellish legion" chasing, grabs the horse's tail, which comes off. In fine, tongue-in-cheek moralistic mode, the poem concludes:
Now, wha this tale o' truth shall read,

Ilk man and mother's son, take heed:

Whene'er to Drink you are inclin'd,

Or Cutty-sarks rin in your mind,

Think ye may buy the joys o'er dear;

Remember Tam o' Shanter's mare

Question: What stopped the devil and witches from following Tam?
Answer: Running water.
Alternative answer: His horse