Why did the United States enter World War I? How did the United States contribute before and after World War I?
In popular consciousness, the obvious answer to this question is "because of the Zimmerman telegram", which is not a full answer, but it did serve as the last straw for the American people, convincing them that war with Germany was inevitable. The origins of the infamous telegram have been the subject of much debate, with some suggesting even that it was a hoax sent by Allied troops to spur the United States into action. This is thoroughly unlikely, but it gives some indication of the status the telegram achieved and retained thereafter. The telegram, sent in early 1917, was a promise from Germany to Mexico that the lands they had lost to the United States in the Mexican-American war would be returned to them as a reward for joining in the war on the German side. This enraged the American public and swung support in favor of the war—but ongoing events since 1915 had already effectively determined Woodrow Wilson's opinion that the US must enter World War I.
At this point in time, the United States traded intensively with Britain, meaning that its ships were regular fixtures in European waters. Before the war, this was not an issue, but after war was declared, it swiftly became clear that American ships were in danger, despite the fact that the United States was ostensibly a neutral country. In 1915, Germany publicly announced that these attacks on United States ships were deliberate: part of its strategy was to lock down the island nation of Britain and deprive it of all incoming goods by simply blowing up any ship that threatened to land there. One of the most notable ships sunk by these German attacks was the Lusitania, a passenger liner and sister ship to the Titanic, which was sunk in 1915 resulting in the loss of thousands of civilian lives. While the German response to the outrage this caused was to promise no further attacks on civilian liners, this promise was not kept. Attacks on American and other foreign ships began to intensify in the latter half of the war, when Germany feared it had lost and was desperately trying to push Britain into declaring defeat. Spurred by the turn in public opinion generated by the Zimmerman telegram, the United States entered the war on April 6, 1917.
The second half of your question is less clear, but I will answer based on my understanding of it: how did the United States contribute to ending World War I? One of the major reasons Britain sought the aid of the United States was because of its financial clout. The United States could, and did, contribute significantly to the war effort in terms of funding and weapons, as well as sheer manpower. The American troops, unlike the worn-down British and French, were enthusiastic and new to the battle, although in most cases they were as untrained as their Allied counterparts had been. Their assistance was particularly important in the Spring and Final offensives of 1918, when the Germans were pushed back out of France and into Germany. The arrival of so many fresh troops was also a propaganda victory for Britain, as it helped lift the spirits of the men who had, in many cases, been fighting for three years and were beginning to feel worn down. Of equal importance was the blow their arrival struck to German morale, which was already low.