(I'm referring to the TV commissioning process here - either one-off original drama, or a series)
Writer or writer's agent submits a proposal to an indie co-producer. Indie co-producer options the 'idea', with a clause to renew the option. They'll normally haggle for an 18 month option, writer will normally hold out for 9 months or a year.
Indie will submit the proposal to the broadcasters. If it appeals to them, writer and co-producers will be invited in to discuss project. From there, the broadcasters will assume financing, and if a one-off, first commission a detailed treatment. If a series, they'll commission both a broad treatment of the story and a detailed outline of subsequent eps. If satisfied, they'll then commission the scripts.
The treatment and outline fees will be payable against the script payment, and in the case of the outlines or treatments, 50% on signature and 50% on delivery. When moving on to script, payment is then 50% on commencement (as the contract covering the treatment/outlines also covers the script), minus the fees already paid for treatment/outlines. Payment is then staggered to 25% on delivery, 10% on first rewrite, 10% on second rewrite, 5% on polish.
If the broadcaster is making the drama in-house, it can be a different process. A writer will be invited in on the strength of his/her proposal, or to discuss an in-house idea that the drama dept are looking to develop.
The commissioning process is much the same, though.
For film, and if through an indie, the script can be commissioned and developed by the indie, who in some circumstances then go looking for finance from some of the bigger companies on the strength of the script.