Why do cells vary in shape and function when they have the same genome and the same organelles?
Because cells are not only characterized by by their genetic material and other interior components, but also by the genes they express. Cells have to fulfill multiple different functions to be able to build complex multicellular organisms. Differently expressed genes lead to different proteins made in the cell, which leads to different morphology, shape or function. For example melanocytes in the skin are highly specialized cells which mostly make the pigment melanin. Plasma cells on the other are highly specialised for making antibodies.

It is all about regulation of genes. The RNA doesn't know or transcribe anything - 
the DNA is trancribed into the mRNA (which is then further processed) and finally translated into proteins. Cells develop from precursors which proliferate and finally differentiate into highly specific cells. This progress is controlled and activated by specific transcription factors and growth factors. For example: pigment cells only develop, when a specific transcription factor is present. When this factor cannot be expressed, these cells do not develop at all.

This developmental process is shown schematically in the figure below (the figure is from the NIH website on stem cells):