Bicycle trainer. A bicycle trainer, also known as a turbo trainer, is a piece of equipment that makes it possible to ride a bicycle while it remains stationary. They are commonly used to warm up before races, or when riding conditions outside are not favorable.

Operation 
A trainer consists of a frame, a clamp to hold the bicycle securely, a roller that presses up against the rear wheel, and a mechanism that provides resistance when the pedals are turned. In a wind trainer, the roller drives fan blades that create air resistance. These are typically the least expensive and noisiest trainers. Magnetic trainers have magnets and a conducting flywheel operating as an eddy current brake. They are moderately expensive and moderately noisy. Some magnetic trainers have handlebar-mounted control boxes to change the level of resistance during a training session. Fluid trainers use liquid-filled chambers to create resistance. They are the most expensive and quietest trainers. A small number of trainers use a centrifugal pressure mechanism to create resistance, involving pressure plates, ball bearings and specially shaped grooves. These are similar to fluid trainers in price and performance.

Function
Trainers make it possible to build bicycle skills and power very efficiently in a highly controlled environment, without the unavoidable interruptions of outdoor riding. For instance, in hill training, instead of being limited to whatever hills are around one's home, one can simulate any size and steepness. Trainers provide better preparation for racing than stationary bicycles. Trainers require better technique than stationary bicycles, and they provide a more realistic-feeling ride. The geometry and resulting body position of a stationary bicycle may be significantly different from a racing bike; of course, if one uses the racing bike itself in an indoor trainer, the body position is nearly identical.

Some trainers are equipped with sensors that monitor the rider's performance. Power output, cadence, virtual speed and heart rate are among the metrics that can be transmitted electronically. Analyzing these figures can help to fine-tune the athlete's training.

Types
Bicycle trainers are categorized by how the unit provides resistance. There are two broad categories: "wheel on" trainers use the bicycle's own rear wheel, whereas "wheel off" or direct-drive trainers replace the rear wheel with the trainer's own machinery. Within those two categories, there are also 'basic' and 'smart' trainers, which differ through their ability to connect with other devices. Direct drive trainers are almost exclusively 'smart,' and Wheel On trainers are almost exclusively 'basic,' but exceptions do exist. The Wahoo Kickr Snap is an example of a smart wheel-on trainer.

Wheel on
Wind — The unit uses a fan powered by the cyclist's leg power to provide resistance on the rear tire.
Pros: Resistance progresses with the cyclist's speed, creating a realistic feeling of cycling on the road.
Cons: Noise, limited resistance.
Magnetic — A magnetic flywheel creates resistance on the rear wheel.
Pros: Nearly silent operation.
Cons: Resistance has an upper limit, prone to breaking.
Fluid — Combines magnetic flywheel with fluid resistance chambers.
Pros: Nearly silent magnetic operation with added progressive resistance.
Cons: Repeated friction heating and consequential expansion and contraction of the fluid can result in seal leaks.
Centrifugal — Specially designed centrifugal pressure plates provide resistance.
Pros: Nearly Silent, resistance curves may be adjusted by the user.

Usually, all trainers can be adjusted for most sizes of road and mountain bikes. However, knobby tires can cause vibration and noise, defeating the purpose of noiseless units.

Wheel off

Direct-drive - trainers that act as a replacement for the rear wheel. 
Pros: No tire noise or wear, accurate power to within 1%, allow for virtual world and real life simulation indoor cycling.
Cons: Heavy, require electricity, expensive, require rear cassette.

Smart
Smart trainers allow users to connect the trainer to a third-party device, such as a computer, smartphone, or tablet, via Bluetooth and ANT+. Applications on said devices are then able to control the resistance provided by the trainer. These are so-called smart interactive trainers. The user's performance is measured by a power meter. The app can then lead the user through a workout or gamify the experience by letting the user ride in virtual worlds where gradients are felt through the pedals. Popular applications include Zwift and TrainerRoad. There are also smart non-interactive trainers, which cannot adjust the resistance but only transmit the rider's data like power or cadence. These are usually smart fluid bike trainers, which are becoming obsolete due to their low popularity.  
Pros: Immersive experience, easy-to-follow workouts, ride with/against other people in virtual worlds.
Cons: Expensive, require electricity, apps often require a subscription.

Basic
Basic trainers feature no electronics, so they cannot connect to third-party devices and apps. Instead, they rely on a manual controller or a progressive resistance curve. 
Basic trainers were ubiquitous until the mid-2010s, but with the advent of smart trainers and the immersive experience they provide, they are now reserved for the entry-level price point.    
Pros: Affordable.
Cons: Less realistic ride feel, less immersive experience.

See also
Bicycle rollers - a similar device, but the bicycle is not held stationary
Bicycle tires for indoor use
 Outline of cycling
Spinning (cycling)
Peloton (company)

References

Trainer

cs:Rotoped