There are many possible reasons for the autopilot to disconnect. The details will depend on the aircraft, but here are the criteria for a Boeing 737 (source: 737 NG FCOMv2 4.20.2 Automatic Flight - System Description):
Autopilot Disengagement
The A/P automatically disengages when any of the following occurs:
- pushing either A/P disengage switch
- pushing either Takeoff/Go-around (TO/GA) switch with a single A/P
engaged in CWS or CMD;
- below 2000 feet RA or,
- with flaps not up or,
- G/S engaged
- [Option - A/P auto-disengages for TO/GA above 2000 feet RA]
[Option - Honeywell -708 FCC and on]
pushing either Takeoff/Go-around (TO/GA) switch with a single A/P
engaged in CWS or CMD above 2000 feet RA with flaps not up or G/S
engaged.
- [Option - Fail-Operational Autoland]
pushing either TO/GA switch after touchdown with both A/Ps engaged in
CMD (except with LAND 3 or LAND 2 annunciated)
- pushing either TO/GA switch after touchdown with both A/Ps engaged in
CMD
- pushing an illuminated A/P ENGAGE switch
- pushing the A/P DISENGAGE bar down
- [Option - Fail-Operational Autoland] activating either pilot’s control wheel trim switch (except with LAND 3
or LAND 2 annunciated)
- activating either pilot’s control wheel trim switch
- moving the STAB TRIM AUTOPILOT cutout switch to CUTOUT
- either left or right IRS system failure or FAULT light illuminated
- loss of electrical power or a sensor input which prevents proper operation
of the engaged A/P and mode
- loss of respective hydraulic system pressure.
As Chris already said in his answer, the A/P disengagement will trigger a warning horn and also illuminate the Autopilot (A/P) Disengage Light (number 1 in the following image from the FCOM):

The pilot flying will immediately take over manual control of the yoke and fly the aircraft. This is typically not as time critical as in a car, where a small deviation from your lane on the highway could result in a collision within seconds. The only phase of flight where A/P disengagement is critical is during an Autoland, where the pilot flying is already fully focused on monitoring the A/P and is ready to take over at any moment.
Re-engagement of the autopilot is possible whenever the autopilot engagement criteria are fulfilled:
Each A/P can be engaged by pushing a separate CMD or CWS engage switch. A/P
engagement in CMD or CWS is inhibited unless both of the following
pilot–controlled conditions are met:
- no force is being applied to the control wheel
- the STAB TRIM AUTOPILOT cutout switch is at NORMAL.
There is also a system on some aircraft requiring some input from the flight crew after a set time, similar to car systems complaining when you drive with cruise control and lane assistant without touching the steering wheel. For example, on the Boeing 777 (source: 777 FCOMv2 15.20.11 Warning Systems - System Description):
Crew Alertness Monitor
The FMC continuously monitors switch action on the MCP, EFIS control panel, display select panel, CDUs and radio transmitter microphone switches. When a predefined time elapses after the last switch action was detected, the EICAS alert message PILOT RESPONSE is displayed.