Needs analysis is a process of determining what items should be included in a course based on an objective consideration of what the learner has to do in the language, the "wants" of all stakeholders (the learners themselves but also eg the people organising/paying for the course), the learner's current competence and the means available. The information may be found out by eg questionnaires or interviews with any of the stakeholders, analysis of documentation (eg exam specifications, the learner's previous work, the type of discourse s/he is expected to produce, textbooks used previously), formal testing and various other tools.
Needs analysis usually has 4 parts :
a) the Target Situation Analysis* : what the learner should be able to do at the end of the course based on his/her objective needs (eg to be able to sell the company's product effectively; to pass IELTs) and the communicative acts that s/he will need to be able to control in order to do so (eg to sell the company's product they will need to introduce themselves and establish rapport with the client, describe the product, emphasise its advantages by eg comparing it with the products of competitors, negotiate price etc etc)
b) the Learning Situation Analysis* - what the learner wants. This, as I've said, may sometimes conflict with the results of the TSA. See here for an account of what I did in a situation like this..
c) the Present Situation Analysis* - what the L. can already do of the items identified in the TSA and what remains to be learnt. This is usually analysed through a diagnostic test.
d) The Means Analysis* - what time there is for the course, what facilities, personnel and equipment etc are available. Constraints like lack of time may mean that you can't actually do what you've identified as important in a/b/c and that priorities have to be established and compromises made.
(*Terms from : Dudley-Evans, T. and St. John M-J. (1998) Developments in English for Specific Purposes, CUP Ch. 7)