How can I cancel the construction of a building?

You can cancel an active construction anytime you want by simply clicking on the respective building and choosing red 'Cancel Construction' button. A second comfirmation window will appear and shows what resources you will get back (generally speaking this is half of what you spent to construct the building). To confirm, you have to click green "Cancel Construction" to cancel the construction.