1) In computer programming, layering is the organization of programming into separate functional components that interact in some sequential and hierarchical way, with each layer usually having an interface only to the layer above it and the layer below it.
Communication programs are often layered. The reference model for communication programs, Open System Interconnection (OSI), is a layered set of protocols in which programming at both ends of a communications exchange uses an identical set of layers. In the OSI model, there are seven layers, each reflecting a different function that has to be performed in order for program-to-program communication to take place between computers.
TCP/IP is an example of a two-layer (TCP and IP) set of programs that provide transport and network address functions for Internet communication. A set of TCP/IP and other layered programs is sometimes referred to as a protocol stack.
2) In Photoshop and many other graphic applications, a layer is a component in a complex image that consists of multiple layers. Imagine a set of transparencies stacked on top of each other. Now imagine that each transparency contains part of a single image. One transparency might have the background. One transparency might have text. Another transparency might diplay the company logo. You can view each transparency by itself, or you can stack the transparencies on top of one another and view the stack as one image by projecting the stack on the overhead projector. It is the same with layers in a graphics application. You can work with or view each layer by itself, or you can combine them (it's called flattening) and view the "stack" of layers as one image. Layers are useful because they allow you to move and manipulate parts of an image to see how your changes affect the whole.