Executive officer

An executive officer is generally a person responsible for running an organization, although the exact nature of the role varies depending on the organization. In many militaries and police forces, an executive officer, or "XO", is the second-in-command, reporting to the commanding officer. The XO is typically responsible for the management of day-to-day activities, freeing the commander to concentrate on strategy and planning the unit's next move.
Administrative law.
While there is no clear line between executive or principal and inferior officers, principal officers are high-level officials in the executive branch of U.S. government such as department heads of independent agencies. In "Humphrey's Executor v. United States", 295 U.S. 602 (1935), the Court distinguished between executive officers and quasi-legislative or quasi-judicial officers by stating that the former serve at the pleasure of the president and may be removed at his discretion. The latter are removed only with procedures consistent with statutory conditions enacted by Congress. The decision by the Court was that the Federal Trade Commission was a quasi-legislative body because of other powers it had, and therefore, the president could not fire an FTC member for political reasons. Congress can’t retain removal power over officials with executive function ("Bowsher v. Synar"). However, statutes can restrict removal if not purely executive ("Humphrey"’s executor), but can't restrict removal of purely executive officer ("Myers v. United States," 272 U.S. 52 (1926)). The standard is whether restriction "impedes the president’s ability to perform his constitutional duty" ("Morrison v. Olson", 487 U.S. 654 (1988)).
Corporate law and other legal associations.
In business, the executive officers are the top officers of a corporation, the chief executive officer (CEO) being the best-known type. The definition varies; for instance, the California Corporate Disclosure Act defines "executive officers" as the five most highly compensated officers not also sitting on the board of directors. In many insurance policies, executive officer means, in the case of a corporation, any chairman, chief executive officer, chief financial officer, chief operating officer, president, or general counsel. In the case of a sole proprietorship, an executive officer is the sole proprietor. In the case of a partnership, an executive officer is a managing partner, senior partner, or administrative partner. In the case of a limited liability company, an executive officer is any member, manager, or officer.
In charity/voluntary sector/non-profit, the executive officer(s) are those appointed to drive the day-to-day decisions of the organization. This is normally a formal appointment made by the executive board of trustees. Specific responsibilities and scope vary and are usually called out in a governance document.
Military.
In the units of some military forces, the executive officer is the second-in-command, reporting to the commanding officer (CO). 
In most non-naval military services that are land-based (except the U.S. Army, where an executive officer is the second-in-command of certain units) or in joint military organizations, the executive officer is an administrative staff position versus a command position. XOs in these positions typically assist a commander or deputy commander (or in the case of joint staffs or joint commands, a director) by managing day-to-day activities such as management of the senior officer's schedule, screening of documents or other products, and oversight of the senior officer's administrative support staff.
Management of individual assets in the airline industry is derived from the military terminology, where an executive officer or first officer, is the second in command of the aircraft. In a fixed wing aircraft, the first officer sits in the right-hand seat, but on a rotary wing aircraft, they sit on the left. Management of the airline as a whole is more in-line with the corporate example above.
United Kingdom.
The term XO is not used in most British Army or Royal Marines units, where the designation second-in-command (2i/c) is used as a formal appointment. However, the position does exist in some specialist regiments within the Royal Artillery where the exact duties vary. In the Royal Air Force, the term XO is informally used between officers and airmen, referring to the officer who is second-in-command. It is, however, formally used in the Royal Navy. In smaller vessels, such as submarines and frigates, the executive officer also holds the position of first lieutenant. Originally, the second-in-command was usually referred to as the first lieutenant (or as "number one"), although it is becoming more common to hear the term XO. On larger ships of the Royal Navy, in which the XO holds the rank of commander, the XO is usually referred to simply as "the commander". The XO also heads the executive department.
United States.
There are executive officer slots in each company, battalion, regiment, and brigade, though generally not at higher levels of command until the army level. The XO is typically the second-in-command, and serves as the day-to-day manager of the command staff. The XO is typically responsible for the management of day-to-day activities, such as administration, maintenance, and logistics, freeing a commander to concentrate on tactical/operational planning and execution and a general officer commander to concentrate on similar planning and execution at the operational-strategic level. The XO may take charge in the absence of the commander, the exception being commands with a deputy commander, although recent army command reductions have either merged the two, or eliminated the deputy. 
A few organizations within the army maintain authorizations for a chief warrant officer to serve as an XO/2IC. One example of this is the Modular Ammunition Platoon, where the ammunition technician acts as the second-in-command during the absence of the platoon leader. While the experience gained as an XO is highly beneficial for an army officer's professional development, it is not necessarily a prerequisite for a command position. At the army level of command, a commanding general will have a deputy commanding general as second in command and an "executive officer" on his personal staff who works as his liaison to the general staff and an aide-de-camp who takes care of his calendar and personal needs.
United States Marine Corps.
The executive officer is the billet of the officer who is second-in-command at the company/battery, battalion/squadron, and Marine Expeditionary Unit (MEU)/regiment/aviation group (i.e., Marine Aircraft Group, Marine Air Control Group, and Marine Wing Support Group) level. Per the "Marine Corps Manual", paragraph 1007.5: "The executive officer shall be an officer of the organization who is eligible to succeed to command, and normally will be the officer next in rank to the commander. As the direct representative of the commander, all orders issued by the executive officer shall have the same force and effect as though issued by the commander. The executive officer shall conform to and effectuate the policies and orders of the commander and shall be prepared to assume command at any time the need should arise." At higher levels of command, the second-in-command is the assistant division/wing commander or, in the case of a Marine Expeditionary Force (MEF), deputy commander. For those commands having a general officer (usually a brigadier general) in command without a designated assistant commander or deputy commander, such as a Marine Expeditionary Brigade (MEB) or Marine Logistics Group (MLG), the chief of staff (a colonel) is the second-in-command. Unlike their U.S. Navy counterparts, XOs of U.S. Marine Corps squadrons in U.S. Naval Aviation do not "fleet up" to become CO.
United States Navy and United States Coast Guard.
The executive officer is the billet of the officer who is second-in-command. An XO is assigned to all ships, aviation squadrons, and shore units and installations, and is responsible to the captain for all ship’s work, drills, exercises, personnel organization, and the policing and inspection of the ship. When the ship goes to action stations, the XO confirms that the ship actually is ready for combat and reports this to the captain. The XO's own action station is in a separate part of the ship from that of the captain, so that a single hit will not likely incapacitate both officers. On small ships with no first lieutenant, gunnery officer, or navigator, the executive officer may also be responsible for the duties of those officers. Carrier air wings in the U.S. Navy do not have an XO, but have a deputy commander (DCAG) instead; for shore-based or functional naval air wings headed by a commodore, the equivalent position is the deputy commodore.
In the U.S. Coast Guard, on board small cutters and patrol boats that are commanded by either a junior officer or a senior enlisted member, executive chief petty officers or executive petty officers are usually assigned to serve as second-in-command.
On U.S. aircraft carriers, per Title 10 United States Code, both the captain (i.e., the commanding officer or CO) and the XO assigned to the ship are naval aviators or naval flight officers. Although not specified by 10 U.S.C., large, air-capable amphibious assault ships will have one of the two senior positions (CO or XO) occupied by a surface warfare officer and the other by a naval aviator or naval flight officer, alternating at each change of command. In naval aviation, in U.S. Navy squadrons (other than fleet replacement squadrons and the Navy Flight Demonstration Squadron {viz., Blue Angels}), the XO will eventually "fleet up" to become the CO of that squadron after twelve to fifteen months as XO. This fleet up model was also adopted in the early 2000s for XO and CO positions of both large amphibious assault ships (but not aircraft carriers) and "Arleigh Burke"-class guided missile destroyers. In addition to operational and tactical responsibilities, XOs also shoulder most of the CO's administrative burden, to include oversight of the command's administrative officer (if assigned) and administrative department.
The term of XO in the Navy and Coast Guard should not be confused with the term "executive assistant" ("EA") in those services, the latter being an officer in the rank of captain (O-6) who serves either dual-hatted as, or in addition to, the chief of staff to a flag officer.
United States Air Force.
In the U.S. Air Force, XO is not a command or second-in-command position. Instead, it is used to designate a company grade officer or junior field grade officer who serves as a staff administrative assistant to a senior officer, starting with a commander at the squadron level or above (e.g., squadron, group, wing, numbered air force, major command). In the other uniformed services, this position may be called an aide, an "executive assistant" or an adjutant. 
Like the Army, while experience gained as an XO is highly beneficial for an Air Force officer's professional development, it is not necessarily a prerequisite for a command position. However, it is often the norm that nearly all Air Force commanders will have been an XO at some point earlier in their careers. For officers holding second-in-command positions, the U.S. Air Force uses the titles of "vice commander" (CV), or "deputy commander" (CD) for an officer who serves as the second-in-command for an organization above squadron level. For a squadron level organization, the second-in-command is typically termed the "director of operations" or "operations officer" (DO). These latter terms were previously used for similar positions at the group and wing level until renamed as the "operations group commander (OG/CC). The rank of an executive officer in the U.S. Air Force can vary from a junior officer supporting a mid level commander up to a senior field grade (FGO) supporting a general officer.
Personal staff officers.
The U.S. Air Force uses the term "executive officer" for officers assigned as personal staff officers to general officers. Their role is similar to aides-de-camp in the U.S. Army, and Marine Corps and flag aides and flag lieutenants in the U.S. Navy and Coast Guard.
Executive officer, Supreme Headquarters Allied Powers Europe.
A unique application of the term is executive officer to the Supreme Allied Commander Europe, and commander, United States European Command. This position is typically held by a brigadier general or rear admiral (LH) and is drawn from all of the armed services. The duties involve serving as both an "executive assistant" to Supreme Allied Commander Europe (SACEUR) and also includes command responsibilities for the U.S. military community at Supreme Headquarters Allied Powers Europe (SHAPE) in Belgium.