This varies from company slightly, but it depends on Midshipmen training schedules for the summer and a Midshipmen's desire to be a detailer. Some Midshipmen schedules are already full with internships, cruises, summer school, Leatherneck, Mini-Buds, sailing, exchange programs, Protramid, dive school, and a million other things out that are out there. I know things change slightly from year to year on training requirements and availability. Traditionally one training block is pretty mandatory with some type of cruise: surface cruise, YPs, aviation cruises, subs, and other items. The other training block usually allows more flexibility to tailor to specific interests, some of these require selection processes to even be considered for the training. Again... this varies from year to year, what class you are, funds available, Supt guidance, etc. Generally as a Mid progresses they get more flexibility on the type of cruises they can select to allow more exposure in areas they are considering service selecting.
For detail selection, most companies it is a selection process. For Midshipmen who desire to serve on Battalion and Regimental staff for detail their is an application/interview process. For those who want to remain at Company/Platoon level it is usually a matter of matching up schedules, desires, interviews, and placement by company staff. Company officers and senior enlisted advisors are looking for solid teams to be assembled as the detailers must work well together as it is a long summer of little sleep and a fast paced schedule. Each company provides squad leaders and a platoon commander for each set of detailers. Each company also provides detailers for a mix of positions at the company level. Normally each academic year company fills the Company Commander Position for one set of detail and then it moves to their sister company for the other set of detail. Same goes for positions such as XO, Ops, Admin, etc. Competitiveness can range from year to year for these positions. My second class year (when they were still squad leaders) it was very competitive. My firstie year, they had to draft people.
NAPS detail is also done through a selection process. Again this can be a very competitive process, it all depends on the year and training schedules how competitive these positions can be.