How do power companies regulate power plant's voltage output?
How does some god knows what voltage and frequency generated at a dam ends up as steady 50 hz sine wave household voltage


It's 50Hz when generated - the generators are built with a number of phases and run at a constant speed.


  Whether it be a thermal power station or nuclear power station or a hydroelectric damn its impossible to keep all the dynamos running at a fixed speed. 


Other way round: before connecting a generator to the grid, it is absolutely essential that it is running at almost the right speed, and in phase with the grid. Once it's locked into the grid, there is a feedback process. Trying to run "ahead" will increase the resistance torque along the shaft, running "behind" will decrease it. This keeps the corresponding turbines running at the right speed.

So when powering up the system, the generator would be spun up with manual control of turbine power levels, then carefully brought into phase, and then a huge switch would be thrown to connect it to the grid.

The 19th-century system for doing this involving lamps is described in https://en.wikipedia.org/wiki/Synchronization_(alternating_current)

See also How to synchronize a generator on the electrical grid?

(Big exceptions: wind turbines and solar PV panels. But that warrants a whole other question and answer essay. As does "what happens when you don't have the grid to sync to", known as black start.)

Also see

The electricity grid: what keeps small power generators from being &#39;driven&#39; by large ones?

What happens to excess energy fed into the power grid?