There is a distinct difference between being fired and being made redundant; there are common factors though. The reasons that might get you fired will overlap with the reasons that might mean that you're the one being let go rather than being kept around.
So a huge possible reason is breaking the law, or at the very least, ignoring or being ignorant of the regulations.
Not doing your job is quite important, but the law in most developed countries sides generally with the employee here - if you're not doing your job there are hoops that your employer needs to jump through. Several times, though, paying someone off is the easiest way out of this.
Having a bad attitude isn't really grounds for dismissal, your employers weren't forced to hire you in the first place and weren't force to retain you at the end of your probation period. If they then decide that your face doesn't fit, see the previous point.
Employing people is actually quite expensive, the general rule of thumb in the UK at least is to double the salary (once you've considered tax, NI, pension contributions and the marginal cost of office space, etc.) but you've also then go to consider the cost of not having someone in that position.
Ultimately getting fired (as opposed to laid off) is actually quite hard.