How is the airspeed-Mach number transition handled in modern airliners?
Does the pilot flying have to manually "push the button" on the control panel?

It's automatic, with a manual changeover button available to the pilots as shown below (label no. 2).



How does the aircraft know when the transition should happen?

When the target climb indicated airspeed (IAS) equals the target climb Mach number, the changeover takes place, usually around FL260. Likewise for the descent. The target speeds are managed by the FMS and can be changed.

Image shows the FMS CDU.


  (3) Displays computed values or manually entered values for the selected mode.