tKF
How do they know? I tell them!
If I call a radar unit and ask for a FIS, and don't give any routing information, I won't expect any handover to the next unit. Might get it on occasion, but that's unusual.
If I tell them my routing - including the name of the next radar area(s) - and particularly if I ask for RIS, it's pretty likely.
I don't ask for RAS if I'm in VMC, because that makes both me and the Controller very busy.
If you're in the USA, and file a VFR flight plan, you can ask for and get "flight following" the whole way, complete with handovers. You also get a squawk at the start that stays with you the whole way. That is fabulous! It only breaks down when the weather gets a bit messy and they get too busy as folks change to IFR.
But that's a different system, and we aren't going to get anything like that here in my lifetime. Despite the busy airspace, the UK doesn't have enough controllers to do it - or the will to do it, maybe.