Steinbeck takes the title of his 1937 novel Of Mice and Men from a line in Robert Burn's 1785 poem "To A Mouse." In that poem, the narrator addresses a mouse after turning up its nest with his plough. In the poem's next to last stanza, the poet remarks that the mouse is not the first creature ever to have its efforts at preparing for the future overturned and thus remarks, "The best laid schemes o' Mice an' Men, / Gang aft agley", the comment which provided Steinbeck with the title of his novel.
Like the mouse in Burns' poem, George and Lennie have plans of their own. They dream of a farm of their own, but it seems that their plans for this farm are overturned by unfortunate circumstances, in particular Lennie's inability to stay out of trouble.
Lennie is sorry that he has killed the mouse he found, which seems to echo the comment by Burns' narrator ("I'm truly sorry"). Burns' narrator, however, does not seem to have killed the mouse, but just damaged the "house" it had been preparing.
So, the purpose of the mouse in Steinbeck's novel, in addition to the astute comments made by maganmjh, is to invite the reader to comparison with Burns' poem and to help the reader to realize that life does not always work out in the way that we want or even make preparation for.
Of course, Lennie's accidental killing of the mouse also foreshadows his eventual accidental killing of Curley's wife. The softness of the mouse, which Lennie enjoys so much, is comparable to the softness of the wife's hair, which also attracts Lennie later in the novel.
To demonstrate the childish traits of Lennie; as mice are liked by children due to their gentleness, their small form and cuteness.
They are also used to dramatically juxtapose between Lennie himself and the mice that he so dearly attends to- they are complete opposites. The mice are fragile, small and incapable; whereas Lennie is strong, overpowering and more than capable. The use of the mice in this sense, highlights Lennie's capabilities to the reader to a great extent.
The mice reinforce Lennie's deviance from the norm. It is through their inclusion that the reader is able to realise the problems concerned with his being.