This is a really important aspect of writing papers about literary works at the university level. Perhaps the major difference is that a summary adds nothing to a work, but is just repeating what the work says in a more condensed form. There is nothing one learns from a summary beyond what one one would discover simply by reading the work in question.
An analysis, on the other hand, tries to add something to the reader's experience. It might supply information not readily apparent to readers or it might do very close examination of a work to understand some particular aspect of the work that would not be apparent to a more casual reader. Analyses are distinguished structurally from summaries by being organized conceptually rather than following the order of the original text.
An historical analysis of a work might look, for example, at how a work was influenced by the political, religious, or cultural beliefs of its period. A source study might look at specific influences on a work (e.g. the influence of older stories about Romeo and Juliet on Shakespeare). A feminist analysis would look at how women in a work were oppressed or rebelled against patriarchy. In all cases, an analysis needs some central idea or focus.