I've been reading about the history of Ukraine and it seems that territorial Ukraine has historically been controlled by a constant succession of various states and empires. When did the idea of a united Ukraine emerge and what was its historical or ethnic basis?
Ukraine means "borderlands," as indeed it was a major disputed territory. For a time, the Kievan Rus united many of the East Slavic tribes under Russian rule. Many ethnic Russians lived around Kiev, which was the capital. After Kievan Rus fractured and was destroyed by the Golden Horde, the areas around Kiev were eventually captured by the growing Grand Duchy of Lithuania. When Poland and Lithuania united under the Union of Lublin, the Ukrainian territories of Lithuania reverted to Polish control, where the Poles carried out a program of Polonization. They encouraged Roman Catholicism over the Orthodox Christianity of the natives. Meanwhile, the other Russian territories were united by the Grand Duchy of Muscovy, which was ethnically Russian, eventually forming the Tsardom of Russia.
During the 1600s, the Cossacks started a rebellion against the Poles. They had control over the areas we define as Ukraine, and after a series of very bloody conflicts between Poland, the Cossacks, Russia, and the Ottomans, they made a deal with the Russians where they would essentially serve Russia as long as they were able to remain autonomous. This autonomy never really came into form, and there were a series of revolts against Russian rule. Later, as Russia annexed the Crimean Khanate, Ukrainian and Russian settlers immigrated into the newly conquered regions, settling for instance Odessa.
One can argue that Ukrainians are essentially Polonized Russians, For instance, the language has Polish influence. As a simple example, "Da" is "Yes" in Russian, but both Poland and Ukraine use "Tak" as an affirmative. In a sense it is similar to Switzerland, where a combination of foreign cultures-German, French, Italian-led to a new series of values and a new national identity. The sheer oppression by Austrian (in Galicia), Russian and later Soviet authorities contributed further to their desire for independence and a separate national identity.
The thing is that the Poloniezd area of Ukraine only extended to a point. The areas around Kiev and Lviv, for example, given that Lviv was actually a very Polish city prior to the expulsion of the Poles in the early 1900s. Once you head into the Crimea, people there are more likely to identify with Russians, and to speak Russian rather than Ukrainian. Indeed, when I was in Sevastopol in December, whereas in Lviv they had the Ukraine and EU flags waving about, in Crimea it was Ukraine and Russia flags.
Depends on whom you ask. Modern Ukrainians tend to trace the founding of their modern state to the 10th century, with the baptism (into Eastern Christianity) of Prince Volodymir and the establishment of the Kyivan Rus'. At its height in the eleventh century, the Kyivan Rus' stretched from the Black Sea in the south to the White Sea in the north, with Kyiv (Kiev) as its capital. It then succumbed to the kind of feudal fragmentation that didn't differ substantially from its Western European neighbors. The Mongol conquests in the thirteenth century (Kyiv fell in 1240), resulted in a series of tribute paying client states with varying degrees of autonomy. These then were conquered by Muscovy in the east and the Grand Duchy of Lithuania in the west. That's a very brief rundown of the Ukrainian foundation narrative. Your question regarding the emergence of an idea of a united Ukraine is ultimately one of historical memory and ideas of continuity. Various socio-historical entities imagined a united East Slavic Rus'ian (not to be confused with Russian!) state differently at different times. For example, Bohdan Khmelnytsky's Cossacks tended to view themselves as a community of Orthodox Christian believers with republican traditions, thus differentiating themselves from Catholic Poles in the west and authoritarian (though Orthodox Christian) Muscovites in the east. At the same time, many Ruthenian-speaking Eastern Christians in the Polish-Lithuanian Commonwealth (especially those who in 1596 accepted a confessional union with Rome as Greek-rite Catholics), did not share Khmelnytsky's vision. I would argue that a fundamental moment in the creation of a Ukrainian identity which imagined a community of Ukrainians continuously residing from the banks of the Bug River in the west to the Don River in the east came with Mykhailo Hrushevsky's (+1934) "History of Ukraine-Rus'" (began in 1898). Hrushevsky was arguably the first to imagine Ukraine along its current geographic parameters, while tracing its history to the founding of the medieval Kyivan Rus.' He likewise argued for a Ukrainian identity that was thereafter continuous, as evidenced through various proto-national liberation movements, placing particular emphasis on Cossack uprisings in the sixteenth and seventeenth centuries.
EDIT: Just off the top of my head, some secondary readings which I happen to like: Timothy Snyder, The Reconstruction of Nations: Poland, Ukraine, Lithuana, Belarus, 1569-1999; Paul Robert Magocsi, A History of Ukraine; Serhii Plokhy, The Cossacks and Religion in Early Modern Ukraine; Serhii Plokhy, Unmaking Imperial Russia: Mykhailo Hrushevsky and the Writing of Ukrainian History; Serhii Plokhy, The Origins of the Slavic Nations: Premodern Identities in Russia, Ukraine and Belarus.