For example, if a plane is flying from Amsterdam to Miami and is in the middle of the ocean, who manages that traffic? The ARTCC? Or the airplane just flies without communicating for some hours until it reaches an ARTCC area?
Global ATC in general
In the civil aviation domain, international rules are proposed by ICAO. The foundations of these laws have been agreed in 1944 under the Chicago Convention, in particular its Annex 2, Rules of the Air. Nearly all countries are signatories of this convention.
ICAO global airspace structure is divided into large Flight Information Regions (FIR -- their upper layer being conventionally named UIR). A FIR over a domestic airspace is under the responsibility of the country below. A FIR over the international airspace (e.g. airspace over international waters) is under the responsibility of a single ICAO member state which has received a delegation from ICAO.
Within a FIR, enroute services are provided by Area Control Centers or ACC (ARTCC is the FAA local name for ICAO ACC). The first services available (and guaranteed) are information and alerting. Control services like separation can be provided, depending on the FIR.
(That's unfortunately a lot of acronyms, and more are coming soon... I give them only for precision in case someone wants to dig further into details, but you don't need to remember them to understand the system.)
Specificity of Oceanic Control
When a FIR provides control services over an ocean area, such area is named Oceanic Control Area or OCA, and the corresponding ACC are named Oceanic Area Control Centers (OAC). OAC and ACC differ by the procedures they can use to provide their services: ACC are able to track aircraft using reliable radars, while OAC mostly work with voice/data position reports from crews over unreliable long distance communications (that's less and less true with modern means like space-based ADS-B and ACARS/CPDLC/DCPC (see Guidance Material for ATS Data Link Services in NAT Airspace here).
North Atlantic case
All flights which want to maximize (eastbound) or minimize (westbound) the effects of high altitude jet streams of the day over the Atlantic Ocean must use the crowded North Atlantic Organized Track System (NAT-OTS, not to be confused with NATS Holdings, the UK ANSP) when flying at or above FL55. They must obtain an oceanic clearance from the first OAC before reaching their entry point into the NAT-OTS. So to answer directly your question:
The crew using the track system will be in contact with the OCA/OAC controllers during the flight between domestic areas. However to bear with possible unreliability of HF radio transmissions, this contact doesn't have to be permanent. Instead it may occur only at intermediate reporting points spaced by 10° longitude.
They will also be in contact with FIR/ACC controllers prior to entering and after leaving the OCA/OAC.
Transition areas (OTA) exist to bridge between ACC and OAC: See areas ending in "OTA" in the Shanwick FIR/OCA, like BOTA for Brest OTA, bridging Shanwick OTA (UK) with Brest FIR/UIR (domestic France). In OTA, traffic is handled by the regular domestic FIR (actually its UIR, given the altitude flown at this stage) rather than the OCA.
North Atlantic OCAs (source ICAO)
FIRs and their boundaries worldwide can be displayed with this ICAO GIS viewer (be patient at the first use, background resources take time to load):
(source: ICAO FIR viewer)
See full oceanic procedure on IVAO (simulation). This will be for the other direction, because the NAT-OTS system is based on jet streams blowing from west to east.