Sometimes layoffs come out of the blue, it's true, but you can usually pick up on a few changes around the office first.
If you see signs that the budget is tightening, there are hiring freezes, or other people are being let go, that's always a tip off. You should be sure to follow any news stories about the organization, if it's high profile, or the industry as a whole, says Lita Epstein, author of Surviving a Layoff: A Week-by-Week Guide to Getting Your Life Back Together. "If they are saying that the industry is facing cut backs, or a lot of companies in the same industry are losing money, you know that there will most likely be layoffs."
One sign that they might be gunning for you in particular is if your workload gets significantly lighter.
If you start to notice things like this, it never hurts to put your feelers out and see who's hiring. Talk to people, including both friends and recruiters, and see what your options are.