“at the beach” is kind of a broad meaning I’d say. I could be “at the beach”, meaning I’m just in the vicinity of the beach. When we vacation at a city that is near a beach for example, we might say we are “at the beach”. We are not necessarily physically on the sand. Or we could be a little closer…Not on the sand but “at the beach”…we can see the ocean or waterfront. “on the beach” to me means specifically on the sand.
“in the mountain” would, to me, mean we are INSIDE the mountain (maybe in a cave or some sort of tunnel). But we might say we had a picnic “in the mountains” (plural). Which would mean more of a general area. “At the mountain” sounds to me like at the base of the mountain…or maybe “on the mountain” too. If one said “at the mountain” I would imagine them referencing a specific mountain earlier in the conversation.
“At the beach” means in the vicinity, including possibly the nearby shops, a possible nearby cliff, the boardwalk, the sand, or even the water and waves. If one has a picnic “at” the beach, it gives the impression that one is nearby and enjoying the view with a bit of comfort. You likely still have your regular shoes on.
“On the beach” means on the sand proper. If one has a picnic “on” the beach, it means sharing the meal and dealing with the sandiness. You likely have no shoes on or are needing to use something like flip flops. On the beach means you are literally on the beach.
(Perhaps there might be crabs who live “in the beach.”)
“In the mountain” needs more information. Might it be a cave? Here, “in” means inside.
“At the mountain” isn’t really used. Perhaps it’s because mountains are too large. The word “at” begs for higher precision of location; one is never “at” the United States or “at” New York. One can be “at” the summit of a mountain. One can be “at” a saddle on a mountain. One can be “at” a trailhead on a mountain. One can be “at” a picnic spot or campsite on a mountain.
“In the mountains” would mean among the mountains. One could possibly be on a mountain or in a valley, but one definitely has nearby views of mountains around oneself. One could enjoy a picnic “in the mountains.”
“On the mountain” would mean ascended, not necessarily to the summit, but up on a specific mountain. One could enjoy a picnic “on a mountain.” Here, the emphasis would be that one has a view from a higher vantage point.
If you want to say you had the picnic at the top of the mountain, you might say the picnic was “at the summit,” or even “on the summit.”