Learn the Definition of 'On Spec' for to a Writer or Editor
For those of you in the writing profession who don't know what the word "spec" means, it stems from the word "speculate." Simply put, it means that you are writing something for a publication without the permission, implied or explicit, that the publication is going to buy the work from you once you've finished writing it. Basically, as a writer, you're speculating that someone will give you a chance and you're taking a shot in the dark.
Writing Fiction on Spec
Writing on spec is so much the standard in that very few writers today even think about the fact that is what they're doing. If an editor doesn't buy the piece then that's a big disappointment for you, the writer, but then again, as a writer, you will do what every other fiction writer does: stuff your story in another envelope and send it off to the next editor in line. You'll keep repeating the process until either the story gets bought or you run out of editors to approach. It is relatively rare that a fiction story is so specific to a market that it couldn't be sold somewhere else, especially if you're willing to do a little touch-up work in between attempts to get published.
Writing on Spec for Non-Fiction Is Risky
is a whole other ballgame because, in fact, the writing is often very specific to a particular market. For example, let's say you're writing a piece for Exotic Bug Quarterly, the magazine by and for exotic bug enthusiasts.
There is a somewhat secondary market for the piece you're producing (unless, of course, you can put a "generalist" and "populist" spin on it). Therefore, writing on spec is a rather riskier proposition. This is why the submission process for most non-fiction markets is designed to reduce the risk for both writers and editors.
Step-by-Step Process for Non-Fiction Writers
Non-fiction writers begin the submission process with a query explaining their story idea and any previously published story clips that are in synch with the proposed story. The looks at the story ideas and the clips and tries to determine whether or not you're a good fit for the story. If the editor deems you worthy, you'll be contracted to write the story for an agreed upon fee. If you're contracted to write the story and the piece is found unacceptable or is not run some other reason then most likely you'll receive something called a "kill fee."
Risk and Reward as a Freelance Writer
Until you get to a certain point in your career where editors are pre-emptively asking you for work, everything (or at the very least short fiction) is assumed to be on spec. With non-fiction, it's a matter of judging the risks and rewards. If the rewards make sense for you as a writer, it might be worth the risk of putting together a piece you might be able to sell. Whatever you do, make sure you understand clearly what you are doing and why, and what the upsides and downsides are for you. Also, it goes without saying that before submitting any work to a publication you should know the kinds of work they publish.