Assuming the airport provides ground power at the gate, will the Auxiliary Power Unit (APU) be started and used after landing? If not, I guess the engines will only be shut down when the Ground Power Unit (GPU) is connected. In this case, how do pilots know that the ground power is connected, so that they can shut down the engines?
How do pilots know that the ground power is connected?
The ground crew hooks a headset to the plane to communicate with the flight deck.
Once the ground power is connected, they confirm it, also a light comes on in the flight deck confirming external power is now available.
(Source) Ground power switch and light on a Boeing 737.
In a twin-jet airliner, they usually (subject to company) taxi-in with one engine, the other being shut down after it had time to cool down after the reversers are stowed.
They usually shut down the number 2 engine, the starboard side, where the GPU and other ground crew members approach the plane as soon as it is parked.
Many airports have restrictions with regard to keeping the APU running at the gate, due to emissions and noise, unless the plane is pushing back.
Responding to the first part of your question about starting the APU at arrival.
Soon after landing the APU is usually started to provide a seamless electric power transfer and cabin thermal management (cooling and heat) prior to main engine shutdown. Otherwise the aircraft will need to be plugged in electrically and have a large duct attached to provide cabin comfort.