Anglosaxon historians often talk about royal tuns and rotations or voyages the kings took. But that invites more questions to me - if the kings were constantly traveling with their retinue, wouldn't it pose a security risk, as they were always shifting their court?
The constant travel should have made any sensible king make sure he has good scouts. But then how come Guthrum was able to sneak up on Alfred at Cippenham?
Some of Alfred's key reforms during his reign were based on improving the border security of his kingdom, although it's likely that this was a (vast) improvement on the pre-existing system based on earlier Mercian and contemporary French systems rather than a completely new idea. Some good reading on this is in Baker and Brookes' Beyond the Burghal Hidage and Reynolds' Landscapes of Defence. The burh sites which appear across Wessex and later Mercia are situated approximately 40 miles apart and provide a regular garrison presence across the English frontiers. Primarily they are situated at major road junctions, river crossings, landing sites etc. Between these sites was an extensive network of watch stations (still identifiable by tot toponyms) and local strongholds which maintained a regular vigil over main roads, rivers and settlements. This essentially guaranteed internal security, or at least the warning of attack and allowed for garrisons to be mustered in response.
"But why didn't they just go around?" you may well ask. The answer may be that it simply wouldn't have occured to do so. Until the relatively recent onset of accurate mapping, journeys seem to have been conceived of as a route along a series of waypoints and landmarks - 18th century atlases of England are fascinating as they show a series of deliniated journeys marked by waypoints rather than a map as we would understand it. To a Viking raiding party trying to move quickly through a hostile country, trying to discover a new route could be a fatal delay. In fact, when the burh network functioned properly, an enemy party trying to go cross-country could be spotted and rapidly outmanouvred by an English garrison which would be able to use the Roman roads and rivers to its own advantage.
Why Alfred is taken by surprise in 878 is because of the timing of the Viking attack and the intrinsically seasonal nature of medieval warfare. Like any other early medieval polity, the English economy is very heavily agrarian. While the fyrd system means there are standing English garrisons on duty at any time, the majority of the men would have been farmers by trade, and would have been released at the end of summer in order to collect the harvest on which the whole kingdom depended. They would have then returned to duty in the spring, after sowing their crops and the birthing season of the lambs which were central to the wool economy of much of Southern England.
Traditionally this would have been safe to do, as rulers would have known that any potential enemies would also have been doing the same: The North Sea and parts of the English Channel were dangerous enough in the summer (the Anglo-Saxon Chronicle recounts multiple occasions of entire Viking invasion fleets being wrecked in storms) and in winter would have been far too dangerous for Viking ships to reach England, and Vikings who were already in England would have been having to tend their own lands or prevented from travelling by inclement weather. In 878, the Anglo-Saxon Chronicle recounts that the Vikings attacked at midwinter. Such a move would have taken the English entirely by surprise, and the defensive system would likely have been almost entirely unmanned. What's often overlooked in 878 is that the attack at Chippenham gave the rest of Wessex sufficient warning to mobilise its defences. While pop history likes to imply that Wessex nearly fell and Alfred had to fight a guerilla campaign, the Anglo-Saxon Chronicle tells us that a significant Viking invasion of Devon, probably designed to coincide with the attack on Chippenham, was heavily defeated by the Devon fyrd with very heavy losses, which suggests that Devon had sufficient warning to muster and arm. That Alfred was joined by the garrison forces of Somerset, Wiltshire and Dorset for his campaign to Eddington suggests that those counties were also deemed sufficiently secure that their garrisons could be dispatched to join the royal force.
Kings would have travelled with extensive retinues including household troops. It was likely those troops who formed the basis of Alfred's counterattack in 878. The presence of guards, however, was no guarantee of safety. Testament to that was the death of Edmund I, who was assassinated in 946 by an exiled thief while attending a gathering at the royal vil of Pucklechurch near Bristol.