What were the black monoliths? My initial thoughts were that they came from a more advanced species in order to assist man with advancement, shortly after it came to the primates, they discovered they could use bones as weapons.
In the book 2001: A Space Odyssey it was made explicitly clear that the monoliths were the emissary(s) of a benevolent alien species whose main aim was the advancement of less evolved species;
Night after night, the spectacle of those four plump man-apes was repeated, until it had become a source of fascinated exasperation, serving to increase Moon-Watcher's eternal, gnawing hunger. The evidence of his eyes could not have produced this effect; it needed psychological reinforcement. There were gaps in Moon-Watcher's life now that he would never remember, when the very atoms of his simple brain were being twisted into new patterns. If he survived, those patterns would become eternal, for his genes would pass them on to future generations.
It was a slow, tedious business, but the crystal monolith was patient. Neither it, nor its replicas scattered across half the globe, expected to succeed with all the scores of groups involved in the experiment. A hundred failures would not matter, when a single success could change the destiny of the world.
Latterly, the monolith on the moon served as a warning beacon that humanity had advanced to the point of having mastered space travel:
"Piecing things together after the event, we decided that the monolith was some kind of Sun-powered, or at least Sun-triggered, signaling device. The fact that it emitted its pulse immediately after sunrise, when it was exposed to daylight for the first time in three million years, could hardly be a coincidence.
"Yet the thing had been deliberately buried - there's no doubt about that. An excavation thirty feet deep had been made, the block had been placed at the bottom of it, and the hole carefully filled.
The aliens then used the monolith (or rather a vast number of duplicate monoliths, described as "avatars") to collapse Jupiter; creating a new star for the night sky and concomitantly creating a number of new liveable habitats for humanity and the life developing on Europa.
In the film 2001: A Space Odyssey, the nature of the black monoliths is deliberately left unclear.
The director, Stanley Kubrick, stated in a 1968 interview with Playboy that:
You're free to speculate as you wish about the philosophical and allegorical meaning of the film—and such speculation is one indication that it has succeeded in gripping the audience at a deep level—but I don't want to spell out a verbal road map for 2001 that every viewer will feel obligated to pursue or else fear he's missed the point.
The writer, Arthur C Clarke, said:
If anyone understands it on the first viewing, we've failed in our intention.
After Kubrick suggested he was making this remark "facetiously", he responded:
I still stand by this remark, which does not mean one can't enjoy the movie completely the first time around. What I meant was, of course, that because we were dealing with the mystery of the universe, and with powers and forces greater than man's comprehension, then by definition they could not be totally understandable. Yet there is at least one logical structure—and sometimes more than one—behind everything that happens on the screen in "2001", and the ending does not consist of random enigmas, some critics to the contrary.
(Both these quotes are from Neil McAleer's Arthur C Clarke: an Authorised Biography.)
In the book, which was written concurrently by Clarke and published after the film's release, there is a clearer explanation: see the answer from @Richard.
Here's another answer - and it is based on a passage in the book by Arthur C. Clarke:
The monoliths look like tombstones. (As, in the book only, Dr. Heywood Floyd thinks, when he first sees a monolith.)
Therefore they represent Death - and Transfiguration, too. (Clearly referenced by the Strauss music used in the movie!:)
Philosophically speaking, their first appearance in the film heralds/produces/accompanies the transformation of the almost-dying-out man-apes (or Pithecanthropi... at a guess... some would say they are Australophithecines, but there were a great variety of those, one extreme form being huge and gorilla-like, or Sasquatch-like... but I digress...)
As I was saying, the man-apes transfigure into, well, more advanced and advancing man-apes, and eventually something like the current human species.
In doing so, they both died (Death) and transfigured (Transfiguration). For something new to be brought forth, sometimes the old form of it has to go.
Literarily, this is emphasized by Clarke, since the man-ape Moon-Watcher's father is found to have died in the night, at the beginning of that section of the book. The father dies, the son is transfigured.
The tombstone-like monolith is their doom... but in their descendants, their salvation also.
( - If this seems too morbid, well, you could always rewrite '2001' to be a 1960's musical, with the monolith dancing and singing an upbeat song about how the warthog always tastes better dead than alive, even on the other side of the creek... but this verges on facetious. And I'm sure it points up that Kubrick's version is only about 1,000 % better than that, even with a bit (or, a lot) of morbid included.)
The subject of the monoliths has been an ongoing topic for film fanatics since the first viewers walked out of the theater in the 60s. It is common to think of them as radio beacons or some kind of technology. However, there is another point of view which I encourage you to explore. In Rob Ager's analysis on his Youtube channel Collative Learning (2001: A space Odyssey meaning of the monolith revealed (2014 update)) he states that he believes the monolith represents the movie screen itself. I encourage you to watch the two part analysis before making up your mind. I also encourage you to watch Kubrik's other movies (Shining, Eyes Wide Shut, A Clockwork Orange, and Full Metal Jacket) and then go back to 2001 to see what you think. I say this because the monoliths are really his invention. They take on a life of their own in the movie. I also think that the sequel is not worth mentioning when speaking about the monoliths. The sequel is a product of later film generations who can't stand mystery and need pat answers, otherwise they feel cheated. It also wasn't a Kubrik film.
You asked what the monoliths "do." I think a better question is "What do they represent?" I also think that to refer to the book for "source" material is not the best way to go because Kubrik used Clarke's original short story as inspiration, and in his hands, the story took on a life of it's own. This is a Stanley Kubrik film and is filled with visual metaphors, meanings, riddles, and red herrings. He is a film genius, like Orson Welles, so the monolith is going to have several meanings and purposes (purposes for the film audience as well as the inhabitants of the universe he was creating.) Kubrik is a kind of cinema version of James Joyce and his films are like Finnegans Wake except more approachable.
I remember seeing 2001 on the big screen when it was released, and the thing I remember most was the monoliths. I remember most people wondering about them: How big are they? What were they made of? What do they do? What do they represent? Was Bowman inside the monolith at the end of the movie? Who made them? Are they time machines? Etc.
From the point of view of the characters in the movie the monoliths are devices that connect with another civilization. This is what they do. I think Kubrik showed that in the movie quite well. However, I think the monoliths are also for us the moviegoers a representation of ourselves through a movie screen. Are they reflecting our thoughts and ideas? Are the monoliths our way of talking to ourselves and teaching ourselves ideas? Is it possible that the aliens who built these are really ourselves just a future version? There are many monoliths on our planet, some already understood, others still a question mark. Stonehenge daily reveals more secrets.
I'll finish up on this idea: Are the monoliths a reference to Plato's allegory of the cave?