The Old Republic
The Republic was the unified government for thousands of years, but in time it became corrupt. It became accepted to most how things were, but one man saw a way to use the corruption to his benefit. While the Jedi Order was essentially the marshals of the Galaxy, their polar opposite, the Sith, were looking more for personal gain and gathering power. Palpatine, coming from the planet Naboo, became a Senator on Coruscant, implanting himself into the system he would one day twist and ultimately splinter. When he put the pieces back together, he would be Emperor and have ultimate rule over the Galaxy.
A thousand years before the Empire ever came into existance, the Sith were thought to be wiped out by the Jedi Order. While the Jedi sought to help, support, and protect the Galaxy and its citizens, the Sith wanted only to control, rule, and corrupt.
One Sith escaped, Darth Bane. He quietly perpetuated the Sith beliefs, passing on down a line one at a time until reaching the man known as Darth Sidious, who was born Palpatine. Sidious was a master not only of concealing himself and his abilities, but also his true intentions. No one suspected what was beneath the warm and caring smile. Not his machinations, nor what he was truly capable of.
He arranged for his own home planet to be invaded, garnering sympathies for him and putting him directly in line for the Chancellorship. A Sith was dangerously close to controlling the Galaxy already.
The Clone Wars
The Galaxy-wide conflict known as the Clone Wars pushed Palpatine's control even further. With the war on, he was awarded supreme executive power and control over the entire Clone Army. The Jedi did his bidding as well, completely unaware that the Sith they were seeking out was also giving them orders. Nor did the realize that this Sidious, who controlled the Confederacy of Independent Systems from the shadows, was also completely controlling the Republic. Both sides had limitless and expendable soldiers. The only true losers in this War were the Jedi.
With the war coming to an end, and some of the Jedi actually realizing Palpatine's true nature, it was time to take them out of the equation. Newly christened Sith Lord Darth Vader turned against his Jedi comrades and led the Stormtroopers into the Jedi Temple. Across the Galaxy, Jedi were murdered by the Clone soldiers they'd led the last few years. All Jedi were coldly wiped out, with only a few surviving by chance and escaping into exile.
The attempt on Palpatine's life by the Jedi swayed public opinion in his favor. His swift retribution against them was overwhelmingly supported. The Senate even cheered as he declared the Republic finished, announcing the birth of his new Empire.
The New OrderAs Emperor, Palpatine began building his military even further, ruling planets with a system of Moffs. Garrisons were a common site across the Galaxy. Stormtroopers ensured any uprisings were crushed, as did the Emperor's primary thug, Darth Vader.
But also born from the ashes of the Old Republic was the Rebel Alliance, intending to restore democracy and overthrow the Emperor. Slowly, over the course of a couple decades, the Alliance gained power and support. But the Empire seemed to most to be an unstoppable force.