How is the throne from 1 person to another in great Britain?

When the king (male or female) dies, the Crown Prince automatically from that moment on becomes king.