If the sun suddenly vanished, Earth and virtually all life would face immediate catastrophe. The planet would become a ticking time bomb for every living thing that relies on photosynthesis.
For 8 minutes and 20 seconds, no one would know the sun disappeared. Light from the sun takes that long to reach Earth, so we'd have no idea anything happened during this period.
Then came sudden blackout. Without sunlight, artificial lighting from electricity, oil, gas, fire, bioluminescence and fluorescence would become our only light sources. The moon would go completely dark since it reflects the sun's light.
Without the sun's gravity keeping planets in orbit, all planets would fly off in their current travel directions. More immediately devastating, photosynthetic organisms would die immediately. Most plants not grown under artificial lighting would quickly perish.
Earth would cool by 36°F (20°C) every 24 hours initially. The entire world would plunge into subfreezing temperatures within two to three days. Small ponds would freeze within a week, while lakes might take months. Oceans could persist for decades.
Eventually Earth would approach Pluto's temperature of minus 400°F (minus 240°C). The planet could get even colder than Pluto as it moves further away from the solar system.
Human civilization would almost certainly collapse. Some people might survive underground using geothermal or nuclear energy with artificial plant lighting, but this would constitute an extinction event making all others look minor.
Certain life might survive. Tardigrades could endure these conditions. Non-photosynthetic bacteria around deep ocean vents would likely survive since they use chemosynthesis instead of photosynthesis.
The sun won't actually vanish suddenly, but it will die in approximately 5 billion years, expanding into a red giant that could swallow Earth.