Yes, a primary still takes place with only 1 candidate ("the presumptive nominee") remaining in the race.
People can still vote for the other candidates appearing on the ballot (who have since dropped out), and the results will be counted - however - they just won't go toward the actual race.
It's why many states that vote late in the primary/caucus process try in earnest to move up their date. Voters in states like California, New Jersey and even Indiana, frustratingly find that late primaries just don't matter. The races have already been decided by the time their state finally gets the chance to vote.
The primary still takes place ALSO because there may be other races (senate, congressional, state, local) plus measures on the ballot to vote upon.
One other thing...
In states like California, Louisiana and Washington, the top-two primary is used for state and Congressional races.
What does this mean? In top-two primaries all candidates, regardless of their party affiliation, are listed on one ballot. Voters then choose their favorite candidate, and the top two vote-getters become the candidates in the general election.
Why is it important? Let's say the Republican Presidential race is already decided, so Republican voters stay home for the primary. There's a chance that, because the Democratic race is still undecided and Democrats come out in droves to vote, the top-two candidates will now be Democrats or 3rd party. Because Republican voters stayed home, it changed state and congressional primary race outcomes. Interesting, eh?
The top-two model is not used for presidential primaries in any state. In Nebraska, it is used only for the state's nonpartisan legislature and for some statewide races.