A pilot is essentially an audition episode of a potential TV series.
Typically, production companies will produce a number of pilots every year (during a period known as pilot season), and they will attempt to sell these pilots to the networks (both broadcast and cable). A large number of pilots are never sold. Those that are sold (or picked up), are generally given an order for a certain number of episodes (usually a half [roughly 13] or full [roughly 24] season's worth), which the network will finance. It's generally only after the pilot is picked up that a full staff is hired, office space is set up, and all the necessary sets are built.
The pilot usually goes on to be the first episode of the series, but sometimes casting changes or rewrites are ordered by the network, so a new first episode will be shot.
Backdoor pilot: A pilot episode filmed as a either a standalone movie so it can be broadcast even if it is not picked up as a series; or a pilot that is actually filmed as an episode of another series, which would make it a spinoff in a way. An example of this is the Star Trek episode Assignment: Earth, where the Enterprise crew went back in time on Earth and met the undercover agent Gary Seven. Gary Seven and the other characters introduced in the episode were intended for their own series, which was never made.
Busted pilot: A pilot that never makes it past the boardroom stage. A network may order roughly 20 pilots each season for consideration, but only about a dozen will be picked up to be made into the series, and the other pilots will most likely never be seen again.
Put pilot: A pilot produced in a deal that ensures the network substantial penalties if the pilot is not aired. This almost guarantees that the pilot will be made into a series. Put pilots often have influential backers. An example is Studio 60 on the Sunset Strip created by Aaron Sorkin. NBC faced a penalty in the millions if they didn't pick it up for the Fall 2006 season.