Scientists in the USSR knew, like scientists in all major nations in the early years of World War II, that atomic bombs were theoretically possible. But during the war they had no resources to pursue this themselves, as they had plenty of pressing problems on their doorstep.
In 1942, the Soviet physicist Georgii Flerov wrote to Stalin, telling him that he was fairly certain that the US must be working on an atomic bomb, since no US physicists had published on nuclear fission since the war started. This helped kick-start their major interest in what the US what up to.
They couldn't do much during the war, but they did have spies. The most important of these was Klaus Fuchs, a German Communist who had fled to the UK and was working on their nuclear program. He volunteered his knowledge as a mole to the Soviets in 1941. He became increasingly important when the US decided to go all-out in building a bomb in 1942. Fuchs was a member of the British delegation to Los Alamos in 1943 and he was at the heart of the bomb development research there. The young American physicist Theodore Hall also volunteered information, as did the engineer David Greenglass (brother-in-law of Julius Rosenberg). The Soviets put the physicist Igor Kurchatov in charge of coordinating the intelligence information received, and the Soviets used their extensive intelligent networks to get as much information as possible out of their moles.
After Hiroshima, Stalin ordered a full-scale bomb project. He put the chief of the NKVD (secret police), Lavrentii Beria, in charge of the project. Kurchatov worked as his scientific advisor.
Making a bomb requires many types of work. It is often assumed that because the Soviets had intelligence information about the US bomb, and in fact their final bomb strongly resembled the US "Fat Man" bomb dropped on Nagasaki, that they simply and easily "copied" the bomb. This is an erroneous assumption that misunderstands how the Soviet Union used the intelligence information, and also the relative value of theoretical knowledge to making a bomb.
The Soviets did not "simply" copy the US bomb. The reason is this: Beria did not trust the intelligence. He also did not trust his own scientists. He trusted, well, nobody. Because you don't survive the Stalinist terrors as the NKVD chief if you trust people. He thought the Soviet scientists might be disloyal, he thought the foreign moles might be disinformation.
To weed out disloyal scientists, Beria had a simple system. First, every major scientist gets a "bodyguard" who is allowed to execute him if need be, and an "understudy" who will replace him if he gets executed or imprisoned. Second, every research problem would be tackled by at least two researchers who were unaware of the identity or presence of the other. If the researchers came up with contradictory answers, Beria would summon them both and have them explain to him who was right and who was either incompetent or disloyal. (I call this the "Beria School of Management" — how to get results when you trust nobody.)
As for the intelligence information, he used it as a guide and a "check." It helped structure the basic research, but he made his scientists re-check all of it. The fact that there was foreign intelligence was kept secret — only a few scientists at the very top (e.g. Kurchatov) knew this. The other scientists in the Soviet program were given "sanitized" versions of the intelligence, made to look like it came from other secret Soviet laboratories. So as far as they knew, it came from yet another shadowy laboratory and may or may not be correct. He didn't use it to take shortcuts — he had his scientists even look down the "blind alleys" that you might think the spy data would help you avoid. In short, he had his scientists re-research the entire program. The intelligence information did not save them very much time as a consequence. The irony here is that Beria wanted the first Soviet bomb to be basically the same as the one the US had — but nearly all of the scientists didn't know this is what they were doing. They thought they were doing it completely on their own, along the lines of their own design.
They also had some scientists from the German atomic program as well. These were kept segregated from the Soviet scientists (because Beria didn't trust them, surprise).
But "intelligence," or theoretical information, is not what sets the pace of a bomb project anyway. In the Soviet Union, as in the USA, the pace was really set by the production of fissile material, the fuel for the bomb. This is the hardest and most expensive part of any bomb project. And here the Soviets were at a distinct disadvantage: they had no known, rich uranium mines, and the USA and UK had taken secret measures to secure 97% the known uranium reserves in the world. So the first order of business was conducting a big survey into Soviet-controlled uranium resources.
Uranium is found in the ground as an ore mixed with other types of elements. For a uranium mine to be considered profitable in the American Southwest, the ore needs to have around 5% uranium in it. That's not very much. Ores from Canada had around 30% uranium — much better. But best of all was ore the Americans got from the Belgian Congo, which could be as high as 75% uranium.
What did the Soviets have? Ores around 0.1-0.3% uranium. So a big project was figuring out how to use low-grade ores, and to get enough of them together to do useful things with them.
The acquisition of uranium ore ended up being the thing that set the time-table for the Soviet development of the bomb — not scientific research. The general estimate these days is that the Soviet espionage might have helped them by a year or half a year at most. It may even be less than that, since they used it so redundantly.
It was a huge project. Some figures put the number of people working on it at around 600,000 (which is about the same as the Manhattan Project), though I don't know where those figures really come from and suspect it could be even more. They had good scientists, a strong will to produce the bomb, ample information, and lots of cheap/free/slave labor. In 1945, most scientists estimated it would take them about 5 years to get the bomb — it took them around 4, which isn't really far off from the estimation (and those scientists didn't know that the Soviet interest in the bomb started well before 1945).
Sources: Holloway's Stalin and the Bomb is still a great source; Gordin's Red Cloud at Dawn adds a lot of new information that was released in the late 1990s/early 2000s about how they used (and didn't use) the espionage information.
EDIT: I typed the above from memory without checking a few numbers and got a couple wrong; I've fixed them. The Soviets were more uranium-poor than I even recalled, and the US monopoly on world reserves was more impressive than I remembered. The italicized numbers come from Gordin. The percentages of uranium in the Manhattan Project ores come from Manhattan Project records.
What precisely do you mean? As in, how did they do it, technically? Or what was the background and method behind the research to "discover" the bomb technology?