If we have the map of an environment (an occupancy grid for instance) and precisely know the pose of the robot within it. How can one reconstruct what the laser scan should look like at a given location ?
This would depend on how your map is formed in the first place. Is it saved by aggregating several scans into one map? If so, it'd be very hard to extract individual scans since this information is lost in the registration and subsequent aggregation. You can however, use a filter (eg: radius filter, crop box, etc.) to query the map based on your current pose and extract a portion of the map. This wont give you an individual scan but will be close.
The other option would be to skip the aggregation step and save individual scans with their poses. You will have to write a script to merge them at runtime and view/show a complete map, but no information is lost in the process. Extracting a scan would then be easy, as you just find the scan with the lowest distance between the current pose and one saved in the files.
You can do it manually with a protractor and straight edge - put the center of your protractor on the scanner center, align your protractor's zero-angle mark to the scanner zero, then mark off ticks at whatever your scanner resolution is.
Then you use the straight edge to connect the dots from the center, through each tick, until either you draw to an object or you reach the max range of the laser scanner.
In software, you can simulate this by "ray casting" from the scanner center along each scan angle.