In spy movies, assassins typically stand at the back of trains and buses so they can keep tabs on everybody's comings and goings. This usually culminates in an oblivious target getting violently dispatched from behind (although the hero usually intervenes at the last second). While we don't condone killing people for money, the same tactic can be applied to the art of nabbing window seats.
If you prefer sitting in the window seat and none are available, it makes sense to sit or stand at the very back of the carriage. That way, you'll immediately know when someone prepares to disembark no matter where they happen to be sitting.
This will give you a time advantage over other window seat lovers; especially those that are positioned in front of the leaving passenger. The trick is to constantly keep your eyes peeled and strike swiftly -- by the time other passengers commit to making their move, you'll already be heading towards the vacant seat.