I have quite a lot of items with built-magnets in my backpack, like a mobile phone, an iPod or headphones. How easy is to destroy my compass by putting it too close to these items?
The only reliable information I seem to be able to find points to the fact that if you store a compass next to a strong magnet for a long period of time, it can wreck it. Additionally, it seems that some people have reported their compass becoming demagnetised when stored adjacent to something like a phone, headphones etc. though this appears less common.
My advice would be to keep your compass in a case when in your bag with other such items. As long as the compass itself isn't touching something else with a weak magnet in, I doubt it'd be enough to wreck it (in the short term anyway.) I tend to store my compass in a separate pocket of my rucksack in its case, and I'd say that separation is enough. I highly doubt you need to be so careful as to keep it on an entirely different side of your rucksack or anything like that.
For long term storage I'd be a bit more careful - my compass stays in a drawer with nothing else magnetic in it (just various other outdoors bits such as maps, paracord, etc.)
For the reference, the above applies to weak magnets. If for any reason you were carrying something with a very strong neodymium magnet inside I'd be a lot more careful! Sounds silly, but I do often if I'm putting out magnetic Geocaches.
The needle of a compass is often made from a magnetically very soft material. It is very easy to re-magnetize the needle. This does not happen normally, because the needle always aligns with the external field. Luckily this happens in such a way that the magnetization of the needle is aligned with that of the external magnet. In this case nothing will happen.
If you would hold the needle in place, the needle would change direction (N and S poles will change place) If you quickly touch a compass with a strong magnet, the needle might not be able to rotate away fast enough. In this case it will be re-magnetized and your compass will point southwards in the future. If that happens, you can set it back the same way. I have seen this many times (I work with magnetic materials and use a compass to align them.) I don't know if an expensive compass is any different (I don't think so), but the cheap ones I use can be flipped with a permanent magnet. The bearing is very fragile, and applying a field vertically can break it.
I would not store a compass with anything magnetic close by. If you see that the compass needle is attracted to some item, it is too close. Normally 10 cm are far enough. And it does not hurt to check if the compass has flipped N and S poles.