World War 2 was in reality two wars, so I'll give my answer in two parts.
The European war ended not long after D-day. The Russians had been fighting on the Eastern front and were crying out to the other forces fighting Germany to open a Western front (a side note, 12 million Russians died in WW2). The Western front was created on D-day, which was a giant push by all the allied countries, who pushed through France into Germany. The European campaign ended when Hitler shot himself in a bunker.
The Pacific war started to end as the US started 'island hopping' closer to the Japanese mainland. Fearing a bloodbath if a landing on the Japanese mainland was attempted, the US decided instead to use their new weapon the atomic bomb to destroy Hiroshima. When the Japanese resisted further, the US destroyed Nagasaki, and the Japanese promptly surrendered.