Specifically, spacecraft that are not obviously using centrifugal force to simulate gravity the way that the space station from 2001 does.
There are three modes used in various sci-fi works, and a 4th in some space-fantasy settings.
Mode 1: Artificial Gravity.
This is safely assumed anytime you see decks aligned parallel to the flight path... in other words Aft is back, not down.
The details of how AG works vary widely by universe, but it's all handwavium, so for practical purposes, it's Magic.
Examples: Most shows, especially Trek flavors.
Mode 2: Centrifugal force
Portions of the ship spin to create a simulation of gravity. The actual physics are that the force applied is centripetal countering inertia, but it is commonly called centrifugal force.
Examples: Babylon 5 (Earthforce ships only), and AC Clark's 2001 & 2010 (both books and movies)
Mode 3: Continuous Burn
A few universes make use of constant thrust drives in order to provide a steady downforce. The ship aims at the destination, thrusts halfway, flips, and thrusts to brake until reaching the destination.
This mode is used very little in modern Sci-Fi movies and TV; it was used in some early movies, and is used in a few comics and games, most especially Albedo (both the comic and the game).
The best example I can think of is Niven and Pournelle's Codominion universe. The MacArthur sustains 1G for some time; she's capable of well more, but can't keep people functioning well much over 1G.
This is also implied in some of the older (1940's) Sci-Fi serials... when the rocketship lands vertically, and is shown burning through space the whole trip.
Mode 4: Differential gravity and Tidal Stress
the "Dean Drive" is an artificial and intense gravity well created by a projector; it causes the ship and everyone aboard to fall at 1G (more or less) towards it. Note that up on such ships is variable... further back from the center of mass, up is towards the singularity, as the ship accelerates faster as a unit than the individual; on the forward side, up is away from it, as the individual is accelerated faster than the ship as a whole. This is a function of the inverse square law, and is called tidal stress.
Tidal stress also used in Niven's The Integral Trees and The Smoke Ring for the titular trees in the Smoke Ring. But in this case, it's tidal stress caused by being in orbit, not by an artificial gravity well.
Mode M: Inherent property of magic in the fantasy world
Mostly used in Spelljammer, for the D&D game, but also used in some other fantasy games and their related novels, items generate a magical gravity, often in the form of a plane, either by the magic of their flight systems or by inherent magical properties of the universe.
In Spelljammer, it's the universe... a ship in space in this setting generates a natural 1G field towards the a plane parallel to the decks, and centered upon the center of mass. You can't put a ball in orbit around a ship, but if you drop it over the side, it will come to rest (eventually) abeam, abaft or afore the center of mass. Holding air is an additional effect for this setting.
Mode Null: None A few make no use of means of showing a gravity-like environment aboard ship.
Some of these simply have no ships, so all action takes place on planet.
Others, acceleration force isn't used for gravity simulation, due to fuel constraints.
Several recent shows have used this; early seasons of Stargate SG-1 avoided the issue by having no ships. A number of short lived shows and pilots also had this mode.
Babylon 5 uses both centrifugal and artificial gravity modes.
Niven's Integral Trees uses both acceleration and tidal stress.
It varies from universe to universe. For instance, in Star Wars, this explanation is about all you get:
Artificial gravity generators were used to create a stable field of gravity outside of a planet's natural gravity well, thus aiding life in space.
(There's more, but that's the main point.)
In Star Trek, I can give you a little more. In the Star Trek: The Next Generation Writers' Technical Manual (Fourth Season Edition), on Page 12, under Environmental Systems: Artificial Gravity, it says:
Synthetic gravity: The Enterprise uses a network of force field generators to create an artificial gravity field virtually identical to Earth's. These generators employ a series of superconducting graviton field matrices located under each deck. Because of the superconducting components, these hockey puck-sized gizmos can remain in operation for several hours, even when power is cut off.
Other universes have different explanations, so there is no "one size fits all" explanation for artificial gravity.
In the Stargate Wiki, it says:
Artificial gravity is a piece of technology used on various spaceships and space stations. It allows them to maintain habitual conditions for the crew aboard.
(A little more, but you get the point.)
In a lot of SF, they start with a simple explanation, like the magnetic boots in [Conquest of Space](Conquest of Space - Wikipedia, the free encyclopedia). Generally once the explanation is given, such as magnetic boots, poetic license allows the film to "assume" gravity and you have a lot of shortcuts, like no floating hair, people pouring liquids, and so on. (Also in Conquest of Space, on the trip to Mars, there was also acceleration to provide gravity.)
But there is no overall explanation.
The ship is a sphere built around a black hole and special electromagnetic fields hold it in place. Motion is achieved by feeding matter to the block hole on a point where the exploding mass can pass through an opening in the ships hull giving it thrust. Of course this is slower than light. Faster than light occurs by using the black hole to generate a wormhole. Gravity exists by the distance of the hull from the black hole.
Mode 1 Artificial Gravity (aramis's scale) is usually just hand waved. Sometimes it is explained after the fact in order to answer viewer complaints.
Very few give any attempt in story to explain it.
In Babylon 5 it was the sign of higher tech civilizations. Minbari, Centauri and some others had gravity control. Earth and Narn did not. They never explained how it worked, just that we didn't know enough to understand.
In a story or SF game system that I cannot recall, they had gravity plates. These plates, when charged, pulled stuff to them simulating gravity. The interesting thing about this approach is that the up and down orientation of the decks would alternate since the plate would be the "floor" of two decks.
Star Trek had life support that, when it failed, would still leave artificial gravity running but cause near instant suffocation. I never understood that one (on either side).