The current Dover Castle was built in the 1180's by Henry II. The high ground on which it stands has had a man-made fortification upon it since before Roman times. The medieval castle has only been attacked once when it endured a long siege by an invasion force led by Prince Louis of France in support of English barons rebelling against King John in 1216.
Primarily a castle is a defensive citadel. The high ground gives a vantage point to better see invaders. Surrounded by a great ditch, it is hard to traverse the immediate land without aid from the bridge. The walls are very thick and steep, with few openings. Inside there is more defense in the further reinforced keep.
During peace-time, the castle continued to serve many functions. It garrisoned troops, was the center of local village life, was a hotel for visiting royalty, and provided an appearance of strength to any foreigners.
I hung out with Brandy on this trip and we visited the Tower. Filled with medieval reproductions, this area allowed us a peek into some of the furnishings and customs of the past.
Movie: Age of Ultron (I am a Marvel fan and parts of this film were filmed here in Dover Castle).