The Basic Idea
Basically, a trumpets is an amplifier, a sort of acoustic megaphone. The sound that gets amplified is the buzzing of the lips. The lip buzz is therefore the fundamental essence of a brass instrument's sound, and it works like this: The player firms the muscles of his lips, then blows air out past them at a high enough speed and pressure to make the lips buzz. This buzz has a pitch, which the player can raise or lower by tightening or loosening the lips. In this way, the lips imitate vocal chords and are "singing."
Part of the resonance for this buzz comes in the form of the player's oral cavity, which is then amplified by the instrument. When a player buzzes into a trumpet, it forms a tone.
Overtones and Partials
Here's where it gets a little complicated: The pitch a player gets is partly determined by her lips, but also by something called the overtone series.
The overtone series is an acoustical science term. It refers to the fact that any vibrating object will vibrate at a series of sympathetic harmonies. In terms of a brass instrument, this means several spaced-out pitches that lock into place while playing, called "partials."
For the players, these feel like little shelves or notches where the muscles feel the most comfortable vibrating, because the vibrations of the lips are locking into place with the acoustics of the horn.
The Evolution of the Modern Trumpet
Early trumpets consisted of little more than an extremely long cone shape, which produced a different set of partials depending on its particular shape. For an entire chromatic scale (all the notes necessary for Western music), players needed several trumpets of different lengths. Because this was hardly convenient, the modern trumpet was developed to accommodate complete chromatics. First, the long cones were shortened by wrapping the tubing around itself. Then, with the invention of valves, extra tubing could be added in order to allow air to move through more or less tubing depending on what buttons you push. In essence, pushing down valves makes the trumpet shorter or longer--at least, as far as air flow is concerned.
This, of course, describes the basics. As any experienced player can tell you, actually playing a trumpet takes years to learn and perfect!