I was just watching the Witcher, and they've begun defending a keep, mentioning that it's been guarding the only passage near a river for some time. This got me thinking - keeps such as that one would have been fairly important in medieval times, and building one in a poor location could lead to disaster. However, without modern technology it may have been difficult to locate the best possible position for fortifications. Were there any examples of poorly positioned keeps, and if so what were the consequences if any?
One example that comes to mind is Raseborg Castle (linked picture) in Finland, probably built some time during the 14th century. Due to the relative scarcity of medieval literary sources about/from Finland (then a part of Sweden), we don't even know the exact years it was built. The castle was originally built on an island in the middle of a river, a highly defensible position with easy access to fresh water, and great options for travel and transportation. Rivers and coastlines were major transportation routes after all.
However, during the last glacial period Finland was under the ice sheet. The weight pressed the bedrock down over time, and after the glacial period ended the area has seen post-glacial rebound which still continues for around 3 to 5 mm a year in Southern Finland (where Raseborg Castle is). This effect was unknown to the people at the time. Since Raseborg/Snappertuna River was always a shallow one, post-glacial rebound, along with eutrophication, was enough to render it very difficult to use as a waterway by mid 16th century. For example, the flat, grassy area at the bottom of the picture I linked would have been water back when the castle was originally built, and likely either very shallow water or swampy/marshy ground when it was abandoned.
This, along with other reasons like the establishment of the city of Helsinki in 1550, which made the castle less useful for reasons of trade and commerce, was enough to cause the castle to be abandoned. There was an attempt to resettle it a couple of years later, but then the beer cellar collapsed and the castle was permanently abandoned.
In this case the poor positioning, for reasons unknown to the builders, didn't lead to disaster, just abandonment of the castle. Now it stands as a partially restored ruin and a tourist attraction.