It depends on where you are. What you need is a large bag of tricks, and then you can apply whatever trick you need from that bag for the situation you find yourself in. Here are some ideas to put in your bag:
Ask at a fire station if you can sleep on their floor.
Ask at a church if you can sleep on their floor.
Ask at a church if you can set up a tent in their back yard.
Ask the police if you can pitch a tent in their town park, county park or fairgrounds.
Ask a local if they know of any patch of ground on which it wouldn't be a problem if you pitched your tent. Don't make it sound like you need a campground--you're just looking for a patch of dirt.
Ask at a farmhouse if you can pitch a tent on their property.
Pull off on a side dirt road and see if you can find a level spot of ground sheltered from view by some trees with no houses nearby and without a "no trespassing" sign.
Sign up with www.warmshowers.org
Sign up with www.couchsurfing.org
Buy the ACA maps and use it to find free places to stay.
Find free campgrounds (there are some) or forest service campgrounds with a modest fee.
See if a campground has "hiker/biker" sites, which are generally available for $5 to $7.
Even if they say "no" to "hiker/biker" sites, ask if they have special rates for cyclists (or maybe if they'd make a special rate on the spot).
Ask someone in an existing campground spot if they would be willing to share their spot with you.
Sleep in the dugout of a local ballfield (only if they aren't playing games that night of course).
Sleep under a bridge.
More ideas at http://www.kenkifer.com/bikepages/touring/camping.htm