You beat Minecraft when you defeat the Enderdragon in the End dimension, triggering a long end credits cutscene. However, this does not conclude the game file completely, and you simply respawn back at your last spawn point afterwards.
Reaching the Enderdragon requires crafting endereyes and locating a Stronghold. First, hunt endermen for enderpearls, which serve as the first ingredient. Then go into the Nether through an obsidian portal, and locate a nether stronghold to find blazes, which drop blaze rods that can then be crafted into blaze powder. Combine the enderpearls with the blaze power to craft endereyes. Use the endereyes with right click, and follow the direction they float to pinpoint the location of the overworld Stronghold.
Once you have located the Stronghold, find the Ender Portal, found in a room that generates with lava pools and a Silverfish spawner. This portal requires endereyes to activate, which fit into the empty slots with a right click. This can require up to 12 endereyes in total, but usually a few slots are generated with slots already filled.
Jump into the portal to reach the End, making sure to prepare for a battle with a sword, armor and a bow with arrows. Find the Enderdragon, and shoot the Ender Crystals, located atop the obsidian pillars that generate all over the dimension, in order to stop the dragon's regeneration. Finally, fight and kill the dragon, and a portal appears that begins the ending sequence when jumped into.
Minecraft technically lacks any true ending, due to its sandbox nature. The Enderdragon serves only as a loose goal for players to reach, and the End dimension provides an abundance of otherwise rare or unreachable resources, and the one-of-a-kind Enderdragon Egg.