It is fairly complicated. I'll do my best.
The Zionist movement began in the late 19th century, with the first waves of Jewish immigration to the Holy Land (although there had been Jews there since before the Diaspora). It got organized in 1897, when Theodore Herzl organized the First World Zionist Congress in Basel, Switzerland. Herzl did try to make a deal with the Ottoman Empire to permit major Jewish settlement, but Sultan Abdul Hamid II refused.
In 1916, during World War I, Britain (which was currently invading Ottoman-held Palestine) issued the Balfour Declaration, which declared that the British favored a "Jewish national home" in Palestine. After the war, the British received a 30-year mandate over what is now Israel, Palestine, and Jordan (minus the Golan Heights, which went to the French mandate in Syria). During this time, Jewish immigration continued, and the Jews built their own social institutions. In the 1930s, the British divided the Palestine Mandate along the Jordan River, creating the Emirate of Transjordan (what is today the Hashemite Kingdom of Jordan). By 1939, the population of Palestine was roughly 1/3 Jewish and 2/3 Arab.
Several plans had been proposed to partition Palestine, such as the 1936 Peel Plan, which gave most of the territory to the Arabs, but also provided for a small Jewish state. The Arabs largely rejected these plans. In 1947, the United Nations voted on a new partition plan. This plan divided Palestine into two states, one Jewish, one Arab. Each was composed of three non-contiguous territorial blocks. Jerusalem was given to neither, and would instead be an international city under UN administration. The UN approved the plan, although the Arabs strongly rejected it. A civil war began between Jews and Arabs, which only got more intense after the British left in 1948, Israel declared its independence, and the Arab armies invaded.
As for why the Jews won, well, there are a lot of reasons. Despite having a smaller population and no formal armies, they did have an underground army, the Haganah, which became the Israeli Defense Force. They had better leadership, a cadre of Jewish World War II vets who provided military experience, and they put so many people into battle (including women and teenagers) that the Haganah actually outnumbered the Arab forces it faced.
Source:
O Jerusalem! by Larry Collins and Dominique LaPierre. I cannot recommend this book highly enough.