Who decides whether an airline docks at a jetbridge or parks at a remote stand?
This can depend on all kinds of things, so it's hard to give a definitive answer:


Many low-cost airlines park at remote stands as this is cheaper than parking at a jet-bridge.
Some airports have jet bridges that can't handle particular aircraft types (often large aircraft at small airports) and therefore these aircraft must park at remote stands.
Related to the above, some airports have no customs facilities for jet bridge arrivals (or vice-versa) and therefore international flights must be parked at a remote stand and passengers bussed to customs/immigration.
Sometimes a flight will be allocated a jet bridge in advance but then suffers from a delayed arrival. By the time it gets to the destination the jet bridge that was assigned to it is taken by another aircraft. In this case, the aircraft may have to be parked at a remote stand.
As you say, bad luck can play a role. Airports have a limited number of jet bridges and sometimes there's just no space for your aircraft. 
Lastly, in my experience it is particularly common to get a remote stand if you arrive late in the evening: Some airlines like parking remotely in this circumstance as it's cheaper than parking overnight at a jet bridge.


As I said, it's hard to give a definitive answer but the above are some common causes for being placed at a remote stand.