To keep a nut from working loose, slip a locking washer over the bolt before applying the nut or attach a second 'jam' nut tight up to the original one.
If you are sure you won't need to undo the nut again, deform the exposed threads with pliers or a cold chisel. Or coat them with silicone rubber sealant, epoxy glue or a proprietary nut-locking compound after tightening the nut.
The best way to remove a rusted or 'frozen' nut is with penetrating oil, sold at hardware shops. Let the solution seep in and then, using a spanner large enough to give good leverage, work off the nut with a series of short, sharp jerks rather than an extended pull.
Or heat the nut with a blowtorch or even a few kitchen matches. It may expand enough to break the rust.
To prevent nuts from rusting and freezing to bolts in the first place, coat them in petroleum jelly before use. Then they will always come apart.
If you find that there's no way to remove a nut, destroy it. Hold a cold chisel against the nut and give it a few hefty blows with a hammer.
Here's how to shorten a bolt with a hacksaw without ruining the threads: first, screw a nut well up the shaft of the bolt. Then, before putting the bolt in a vice, put a spring-type clothespeg on it to protect the threads from the steel jaws. Finally, after sawing the bolt off to the desired length, unscrew the nut to restore the threads