I was very close to a child who was born into Islam in a north african country and passed away at only a few months old.
I have gone into a mosque on his birthday every year since and I'm not muslim. I usually have a photo of him with me, I figured I'll ask someone to pray for him or I'll just be there so that someone is remembering this child in the way he should be.
Assuming non muslims aren't asked to not enter at certain times, which isn't the case in most countries, I cover my head, kick of my shoes and follow the women. The atmosphere is also peaceful and welcoming.
I once accidentally got caught in Friday prayers, I hadn't realised it was a Friday and had just stopped by in a country where there was no call to prayer, so I didn't realise. Everyone arrived last minute, as is the tradition for all faiths I find, rush in just on time, I didn't see the men arrive and get into places on a lower level and the ladies all arrived around me. Suddenly prayers started, I looked around, realised what was going on and though oh my goodness, I'm at the front, how do I leave without seeming really rude but I should leave because I'm not muslim. I whispered to the girl next to me, I'm not muslim, what should I do? She said just join in, no problem. I was like Beyonce in the single women dance as I hadn't learned the sequence before, plus one step behind everyone else, no one minded at all.
I told the ladies after why I was there, they were so lovely and welcoming, had a lovely chat with them, they said everyone is welcome, no need to be of any particular faith. It was really lovely.