We always hear stories about lions which were led by donkeys, and we hear a lot about trench conditions where the enlisted and the low rank officers stayed. But what about colonels and beyond? Field Marshals? What would be their General Headquarters in battle, and how close would it be to the frontline? How safe was it from bombardment? Also, what was the case in Gallipoli? Did Army generals always stay in ships or occupied some islands or small portion of Turkish mainland?
We always hear stories about lions which were led by donkeys
First of all we need to deal with this. The phrase entered the public mind as a result of its publication in Alan Clark's 1961 book The Donkeys where he purports that the following conversation took place between Ludendorff and Hoffman
Ludendorff: The English soldiers fight like lions.
Hoffmann: True. But don't we know that they are lions led by donkey
Which is pretty odd, since Hoffman spent his war on the eastern front and had never so much as seen a British soldier in action. In addition, there is no documentary evidence that this conversation ever took place. No evidence at all. It is, fundamentally, a fiction to support Clark's polemic and can safely be disregarded as such.
The issue of senior officer casualties in the British Army in WWI was covered fairly well by Davis and Maddocks in Bloody Red Tabs where they give a figure of all Generals (Brigadiers through Field Marshalls) killed and wounded as 232, though this includes those wounded more than once. Amongst these are 78 who were killed or died of wounds while on active service. Out of a total of 1,257 who actually served, the overall casualty rate for Generals was therefore 18.5%.
Of the 78 who were KIA
43% were killed by shellfire 28% were killed by small arms fire (at least half by snipers) 3 Generals drowned, 2 were killed in accidents, and the of the remainder no cause of death is known but we can safely assume the majority were by small arms and shellfire.
The interesting point here is the surprisingly high proportion killed by small arms and snipers. Overall, its commonly accepted that roughly two thirds of all casualties were caused by artillery. The high proportion of Generals killed by small arms is indicative of the fact that they were obliged to expose themselves to a disproportionate extent, presumably in attempts to reconnoiter the ground over which their forces would soon be fighting.
Thus we can safely say that myth of the 'Chateaux General' is pretty well busted.
The actual positioning of an officer depended on their rank and therefore their role in the battle. A subaltern was obviously in the thick of it with his men, but even Divisional commanders (Major Generals) would often be obliged to come far forward to see for himself what the situation was. In fact, no less than 3 divisional commanders were killed at Loos, more than were killed in the whole of the second world war, and Loos was a fairly small battle!
Even staff officers would often be exposed to fire. The high casualty rates of staff officers in 1914 meant they had to be explicitly forbidden from nearing the front as the casualty rate was unsustainable.
TL;DR - It varied depending on rank and role, but the casualty rates for Generals indicates that they frequently exposed themselves to danger and were by no means 'Chateaux Generals'
Edit: As a point of interest, two British Field Marshalls died on active in WWI. Kitchener died when the cruiser he was sailing on struck a mine, while Lord Roberts of Kandahar (VC) died from pneumonia after refusing to wear a coat to inspect units of the Indian Army in late 1914. They in tropical clothes and he refused to wear anything warmer than his men. He had an interesting career. He was commissioned when the Duke of Wellington was still in charge and he served long enough to be concerned about aircraft and armoured cars.