The fortifications of Copenhagen, Fredericia and Acre are star-shaped. (Defense of Copenhagen is shown in the picture below.) Why not have defenses or fortifications in the shape of a pure square or circle?
Flanking fire allows guns placed in the side wall of the bastion (protected from direct fire from attackers) to safely and effectively shoot at an entire line of attackers (enfilade them) as they are closing to the neighboring bastion. Flanking fire is very effective, because if you miss one attacker, you hit the next one. Check the enfilade link for images.
Here the red arrows show direction of the flanking fire from the guns placed in the protected side walls ("flanks", #3) of the bastions (#1 and #2). More details about the placement of guns in bastion's flank side is in this image of bastion with caponier. Guns in "face" walls (#4) would be much more exposed to enemy's fire.
The star fort has no "dead zones", where an attacker can hide from flanking fire, like a round turret allows.
The star design for bastions was first introduced in Italy in the 15th century, and later perfected by Vauban - in the Citadell of Lille and others. Wikipedia has more nice images and a history of the approach.
Other answers mentioned an inability to fire from above, but that is not the main reason for the star design: its goal is to enable flanking fire. And yes, star shaped bastions do not allow to fire on attackers from above, but that is not necessary (and would be dangerous for defenders), because the walls are subject to more effective flanking fire from the side walls (protected from direct fire of attackers) of neighboring bastions.
Of course Vauban also designed a way how to attack such star fortress, by digging 3 lines of parallel trenches connected by zigzag trenches to avoid enfilading fire down the trench line, with 3rd parallel coming close to the attacked fort's glacis (outer edge of the fortifications).
Images are from Wikimedia/Wikipedia.
The big disadvantage of a square or circle is that once an attacker had reached the wall, they are more or less immune to danger from the defenders. The only place they can be attacked from is directly above, having stuff dropped on them. This means that being at the base of the wall is a place of relative safety for the attacker.
Conversely, for star forts, or the Copenhagen example in the question, it is easy to see that being close to the wall provides no real benefit to the attacker: there are always plenty of firing positions for defenders in cover to shoot the attackers from multiple angles. This makes the job of breaching the walls, or of moving around the base of the wall to a weak point, much harder: attackers are exposed everywhere
Imagine that you are defending a fort with old-fashioned round bastions in the Middle Ages. Your walls are high, but once the enemy comes close and starts scaling the walls, very few of your defenders can engage them.
After the invention of cannons it's even worse. Your walls have to be thicker and much shorter in height, otherwise they would be easily demolished by cannon fire. Therefore, the enemy can more easily scale them with ladders. Also, you have very few places to put your own cannons, and they would also be open to enemy fire.
Now look at the star fort instead.
You have a lot more wall surface you can shoot from, and more importantly, while the enemy is scaling the bastion 2 with ladders, your own men can fire at them from bastions 1 and 3.
Wherever the enemy decides to attack from, they will be under fire from multiple directions at the same time.
Also, the cannons indicated on the image can fire from a very safe spot, protected from enemy artillery. The enemy can no longer destroy your cannons via firing their own cannons from the safety of their camp: in order to even be able to take a shot at your cannons, they have to move very close to the walls. Moving cannons is very slow, and they are very vulnerable in the open.
These outcroppings are called Bastions and they became common when muskets and cannons became common in European warfare.
The problem with a square or circle forts is that when the enemy has reached the wall, they are in your dead zone. You can't fire at them with your musket, unless you lean over the wall, which would make you a very easy target for the opponent's musketeers. Using your cannon against them is completely impossible. All you are left to do is throw stuff at them, just like people did in the early middle-ages.
But in the same situations on a bastion fort, your comrades on the adjacent bastion can help you. They have a perfect line of fire to the enemies which try to climb up to you. And you can pick off those enemies which climb up to them.
And anyone stupid enough to assault the wall between two bastions will find themselves being fired upon from two sides at once.