Your Question, "How does a toilet work" is both easy and difficult to answer. Easy because all toilets have certain functions in common and lets face it, it isn't rocket science. Difficult because many companies have engineered internal toilet parts quite differently.
A toilet bowl is a reservoir of water with an open bowl above and an internal P-trap, [trap way] below. The trap way is formed into the china fixture and bends either toward the front or back of the bowl. The direction is of no consequence. The upstream area of the trap way holds water when the bowl is full. The downstream area of the trap way does not hold water, water flows freely into the drain from it.
When the bowl is filled, [primed] the water is at the top of the upstream trap way and the bowl will hold no more unless the trap way is plugged. When the primed bowl is suddenly flooded with water the trap way floods. The air in the lower part of the trap way is pushed down the drain as the water takes its place. The lower area of the trap way, once flooded with water, will begin to empty into the drain.
With the upstream and downstream areas of the trap way filled the weight of the water traveling into the drain pulls the water from the bowl by siphon action. Thus the water in the bowl and everything in the water are drawn into the drain. At the end of this sequence the bowl will be virtually empty and must be primed again.
There are two main reasons to fully prime the bowl.
The main function of the P-trap in the toilet bowl, or any other p-trap, is to hold back the admittance of sewer gas into the room the fixture is placed in. It does this by being full of fluid. Under normal pressure sewer gas will not push the water out of its way and escape the drain. The toilet bowl is sealed against it by virtue of the water in it. For this reason the water in the trap way is called a "trap seal".
The other season is almost as important. A fully primed trap way begins to flood sooner than a less than fully primed trap way does. The siphon action is greater and lasts longer insuring greater sanitation.
The darker lined area represents the full prime. The lighter lined area represents the bowl in full flood of the flushing sequence.
Note the arrows indicating the water from the wash rim.
One thing all toilet bowls have in common is a wash rim. The rim of the bowl is a hollow water channel with holes along the bottom. When the toilet flushes the rim fills with water which drains into the bowl through the holes in the rim. This effectively washes the inner sides of the bowl with each flush. Even the toilet shown on my page, Victorian toilet repair has a wash rim. Urinals have a similar wash rim, as does the sink on my page, Antique wall hung sink restoration project
At this point we encounter the first division in how toilet bowls work. The vast majority of modern toilets are what we call "siphon jet". In a siphon jet toilet bowl the water entering the bowl during the flushing cycle is not only diverted to the rim wash but also to the the siphon jet orifice. This orifice aims a powerful jet of water at the trap way of the bowl throughout the flush cycle. In this way the evacuation of the standing water in the bowl through the trap way is both initiated and sustained.
In this illustration
A. Is where the water enters through the 2" spud, as this is a "flush ell" toilet.
B. Is the wash rim water channel.
C. Is the siphon jet. It receives water through a by pass, not shown, and is aimed at the trap way.
D. Is the "horn", a ridge of china that in this bowl penetrates into the flange. When this penetrating horn is present the bowl will likely require a 4 inch flange.
My old books tell me that the siphon wash down toilet was the standard domestic model as the siphon jet toilet, which was noisier, was the standard commercial toilet.
A toilet tank is a reservoir of stored water measured to deliver a set amount of water to a toilet bowl when "tripped" by its trip lever.
The tank may be set directly onto the bowl. When this is done we call it a close coupled toilet.
When the tank is set on the wall above and behind the bowl it will be joined to the bowl by a 2" pipe. WE call this a flush ell toilet.
When the tank is mounted on the wall high above the bowl we call it a high wall tank and it will be joined to the bowl by a 1-1/2" or 1-1/4 " flush tube.
Toilet tanks may also be set out of sight in the wall behind the toilet.
When the tank is molded to the bowl it will be called a one piece toilet.
When the tank of a one piece toilet is set this low we call it a low boy. The benefits of a low boy are, the low profile uses less space, and it is much quieter than even a close coupled toilet.
When a 12" low boy is set on a flange roughed in 14 inches from the wall the gap between the back of the tank and the wall is fairly unobtrusive.
There are three mechanisms that must work in concert for a toilet tank to operate properly.
The first is the fill valve. Its task is to maintain the proper level of water within the tank.
The second is the flush valve. It is the flush valve that releases the stored water into the bowl below.
The third is the trip lever. It initiates the flush cycle when it is operated.
This is the old classic ballcock. The old term for anything that dispenses water is a cock. This valve is controlled by a float ball, hence ballcock. Toilet fill valves of this design are no longer legal to install as they have no anti siphon feature. There are good anti-siphon ballcocks available, typically in white plastic. Most are fully adjustable for water depth and inlet flow rate.
This is the new classic, the Fluidmaster 400A. The black plastic tube is the primer tube with its white clip intended to affix the primer tube to the overflow tube of a common flush valve. The dark slots just above the primer tube on the upper valve assembly are the air inlets of the anti-siphon feature. The float will not allow that part of the valve to be immersed. The 400A can be noisy, it has no flow regulator.
See Fluidmaster toilet parts on my page, How to repair a running toilet
This toilet flush valve is the type used in flush ell toilets. We call it a "douglas valve".
The brass shank threads are long enough to pass through the thick china and still leave room for the fastening nut, shown and the slip-joint nut of a flush ell, not shown.
The 2" orifice above the shank is the flush ball seat. Hanging above the seat is the flush ball.
The two brass rods are the lift wires, they control the flush ball.
The guide that secures the lift wires is attached to the overflow tube.
The overflow tube bypasses the flush ball and drains directly into the bowl. It is there to prevent flooding in the case of a fill valve malfunction, and secondarily to allow the bowl to be re-primed after each flush.
The "lower" lift wire which passes through the guide and carries the flush ball must be set as shown. This arrangement allows the float to rise in the water free of the actuating "upper" lift wire.
The upper lift wire must be bent to pass through the trip lever.
Old school Toilet tank parts.
The flush ell carries the tank water to the bowl, it is slip jointed to the flush valve on top and the spud on the bottom. The spud gasket enters the toilet bowl drawn back on the funnel of the brass. As the compression nut is tightened the funnel is drawn back into the gasket. This presses the gasket to the china, sealing the spud into the bowl.
The lugs inside the spud are to allow a back hold while tightening. The tool used is, you guessed it, a spud wrench, nut pliers.
Unlike the brass flush valve this plastic unit will not corrupt. It employs a flapper and has "ears" to carry the flapper. The overflow must be cut to height, it may not rise as high as the trip lever hole in the tank. The chain must be set onto the trip lever so that it is long enough to not be drawn tight when the trip lever is depressed. It must be short enough though to not drag into the flapper's way when it drops onto its seat.