There are several different ways for a screenwriter to get involved with a film project. One way is to write a full script on spec. The idea is to write the script first and then shop it around to agents or producers who might hire you or buy the script for later development.
Experienced screenwriters don't even have to write the script. Through their agent, they can get appointments with producers to pitch an idea for a script. The producer can then decide whether to just buy the idea or to hire the screenwriter to write a full script or a shorter treatment.
Some screenwriters are hired later in the process, after a producer or director has developed an idea. The screenwriter might be asked to write an adaptation of an existing work, like a novel or a play, or even punch up another screenwriter's script by adding more jokes or more realistic dialogue. On large studio films, it's not uncommon for several screenwriters to get credit for the same script.
Some screenwriters start as playwrights, journalists, novelists or other professional writers, while others go directly into writing for film and television. It's a notoriously hard industry to break into, so it helps if you have connections.
The Bureau of Labor Statistics puts the average salary of a writer in the motion picture and video industry at $78,860, but it's not uncommon for a top-tier screenwriter to receive hundreds of thousands, even millions of dollars for a single script.