The castle is supported by magic (unable to be maintained or constructed by any other means),
[1] a good example being the moving staircases, a feature contributed by one of the four Hogwarts founders,
Rowena Ravenclaw.
Hogwarts is also protected by numerous ancient spells and incantations, such as the
Anti-Disapparition Jinx; this can, however, be overridden by the Headmaster (and Dumbledore's phoenix, Fawkes) when necessary. It is also
unplottable and has been bewitched so that, if
Muggles approach the castle, all they will see is a mouldering ruin with a sign warning them to keep out and that it is unsafe. The protective magic over Hogwarts is not only strong enough to apparently resist the dispelling effects of the
Taboo but also to repel even talented dark wizards.
As a result of all the magic that occurs on premises (both from learning students, magical artefacts therein and the enchantments cast over the building itself) a magical atmosphere pervades the entire structure, causing any technology that is not adapted to run off of itto fail. This is presumably why candles and lanterns are still in use. Mechanical things like watches seem to do alright, as Colin Creevey's (traditional, Muggle) camera seems to have worked until it was destroyed by the Basilisk's eyes. (Colin mentions that another student told him that he could develop the pictures so that they moved. One of his pictures shows Harry trying to escape a picture of him and Gilderoy Lockhart.)