There are several ways to answer the question of why an author wrote something, and with a writer like Bradbury, there may be more answers than with some others.
To start, Bradbury was a professional writer. Writing is what he did. I know that sounds basic, but never leave out the option of writing for money.
A second reason Bradbury wrote this is that he consciously and intentionally wrote a lot of short stories, to teach himself how to write. For an extended period, he wrote a short story every week. That’s 52 a year.
A third and more substantial reason can be seen in the title. Bradbury explicitly studied classic pieces of writing, and this story is a modern, technologized fictional version of Sarah Teasdale’s poem “There Will Come Soft Rain,” which also evokes a world that goes on after humanity dies.
A fourth reason is seen throughout his work: Bradbury was deeply concerned with how various kinds of technology were dehumanizing human life or replacing people. You can see this in “The Pedestrian,” where no one walks anymore, or in Fahrenheit 451, where people are more concerned about mass media than living people.
And a final reason is when Bradbury lived and wrote. He wrote this not long after the first atomic bomb was dropped (just a few years), when a lot of American society was becoming actively concerned about the possibility of atomic war. This story sums up some of those fears.