All Info About Nursery Rhymes

Sing a song of sixpence

Blackbirds in a pie
Sing a song of sixpence,
A pocket full of rye;
Four and twenty blackbirds
Baked in a pie.

When the pie was opened
The birds began to sing;
Was not that a dainty dish
To set before the King?

The King was in his counting house
Counting out his money;
The Queen was in the parlour
Eating bread and honey.

The maid was in the garden
Hanging out the clothes;
There came a little blackbird;
And pecked off her nose.

Origin

It seems most likely that it simply refers to the then practice at banquets of cooking live birds in a pie crust, which when cut, would allow the birds to fly out spectacularly and surprisingly!!
It's possible that the pocket full of rye may have been a measurement of the day, and the counting house, (which is also referred to in The Merry Wives of Windsor), was the office where the money part of a business was transacted.

Note: A search for this rhyme on the Internet brings up a large number of sites suggesting that this rhyme originated as a pirates' recruiting song. This is a perfect example of website owners/editors not checking their facts before copying an already published idea. Click here for more information on this alternative explanation