I want to know if I buy a iPhone 4 in another country if I take it home to Denmark where I live, can I then reinstall it so it uses the Danish keyboard and the iPhone is on Danish?
Yes, you can buy a SIM-lock free iPhone 4, such as the ones that get sold in the UK or in Belgium and use them anywhere else in the World where iPhones are supported by local providers.
Be aware that the UK phone ships with a different electrical plug.
Language settings can be set from within the iOS preferences. I have mine running with multiple different keyboard layouts; and you can also set the main language of the device, just as you can set the language of any MacOS device to any installed language (usually quite a few). The nice thing is, that usually all apps also respect that language choice if they provide translations.
iOS devices (and I believe Macs too) come with all supported languages, you just need to choose Danish. You will also be able to choose Danish keyboard, on iOS it is very easy to enable more than one international keyboard and switch between them if you want to do that.
Assuming you are buying an unlocked iPhone 4 all you will need to make sure is that you have a micro sim, or cut down your existing sim card.
I can turn on the Danish keyboard and Danish language options on my US iPod touch, so yes. Whether a Danish carrier will support it (you'll need to get an unlocked phone or you'll have to manually unlock it).