Looking at Wikipedia’s page on the 2016 election, I see that Clinton got 90.48% of DC’s vote; Trump only got 4.07%. This is by far the most any candidate got in any state; behind it is it Nebraska’s 3rd congressional district with 73.92% for Trump. Why is D.C. so Democratic?
Because it's just one (East Coast) city.
When it comes to congressional districts, Nebraska's third congressional district isn't second in terms of the ratio of votes for a single candidate. DC isn't even first. Several districts in New York, for instance, went overwhelmingly for Clinton. She got a full 92% in the 13th district and 94% in the 15th.
When we look at this, it's clear what's going on. Washington D.C. can't really be compared with any state. It's quite small, and due to its size is much more urban than any of the 50 states. In essence, it's a city. Its surface area is 68 square miles, only three times that of Manhattan. This is important, because Republicans have more support in rural areas, and Democrats have more support in urban areas. Congressional districts are often drawn to include both rural and urban areas, which means that these tendencies balance out a bit. But if your district is one city, it's likely to be more Democratic. And of course, most cities on the East Coast of the United States lean Democratic. So in essence, DC's voting pattern isn't unusual if we compare it to the proper metric, districts in other East Coast cities.
As to why cities tend to be liberal, it's a combination of socioeconomic, cultural, and racial and ethnic factors, as outlined here. The occupations that most benefit from liberal policies, such as high social safety net spending, are concentrated in urban areas; those that most benefit from conservative policies are concentrated in rural areas. White voters are more likely to be conservative, and are concentrated in rural areas; African-American and Latino voters, as well as immigrants are more likely to be liberal and are concentrated in urban areas; moreover, exposure to people from different groups is correlated with greater acceptance of those groups, so even white voters in ethnically diverse cities are likely to be more supportive of liberal policies in that regard. College-educated voters are more likely to be liberal, and they are concentrated in urban areas. And so forth.
DC is highly urban (I'm not using this as a dogwhistle for black people by the way, though they are a large portion of DC residents). It's the only quanta of electoral votes that's not only a city, but a city with its surrounding metro area (suburbs and exurbs) pared away since they're part of MD or VA.
For example, compare the DC numbers of 90.48% for Clinton with this electoral map of Chicago, which shows 83.7% for Clinton, also higher than the 73.92% voting for Trump in Nebraska. Chicago also has over 3 times the surface area of DC, if you were to somehow to superimpose a rough DC sized square over downtown, you'll notice that you'll end up with more of the darker blue areas as opposed to the lighter blue areas (when compared to the entire map), raising Clinton's numbers even higher.
Washington, D.C., as you may know, is the home of the federal government. Many of the people there work for the federal government, and many others depend on the federal government for their livelihood. Even if they run a restaurant or a laundry, they probably depend on federal government employees for their income.
Republican candidates in recent decades have often run on a platform of making huge cuts to the federal government, sometimes even of disrupting the federal government, and often deliberately adopt an attitude of confrontation to federal government and its employees. Whatever their other motivations, federal employees know that an attitude of confrontation, cuts and disruption is going to make their jobs harder and probably less well paid. For Trump specifically it was no secret that having a president with no experience of government at any level was going to make the jobs of federal employees harder.
Related to this is the fact that those who want to minimize or abolish big chunks of the federal government (i.e. many Republicans) tend not to get jobs as federal employees, and so not live in D.C.
Demographics: Because it is so, so, so African-American and Hispanic. DC is what we call a majority-minority area.
As of last census, DC reported as 50.7% black (and 9.1% Hispanic). This is actually a big decrease from past decades, where it was actually over 70% black in the 1970's (but less Hispanic as well).
African Americans nationwide identify as about 85% Democratic (and Hispanics about 60%). This percentage has been slowly increasing (offsetting some of the demographic losses). If you do a bit of napikin math, plugging in the national racial party ID numbers to DC's demographic breakdown, you'd expect to see about 64% of DC voters to at least lean Democratic. This is before we account for the fact that white Republicans tend to like to self-sort themselves out of urban areas like DC into more Republican-leaning areas. In the DC metro area, those suburban areas are all in the jurisdiction of Virginia or Maryland, not in DC.
As other answers mentioned, this isn't horribly unusual for a major city in the US's Northeast Corridor. However, with other cities politicians are usually able to blunt this advantage a bit by grouping them with some voters from more rural outlying areas that are heavily white. DC has been carved out as a unit by itself, so the urban area is pretty much all we can get (unless Maryland wants to consider taking it back, like Virginia already took back its half). What you see with deep Republican unpopularity in D.C. is what you'd see with most large US cities if it couldn't be hidden.*
* - The contrary also applies of course, in that, as the question points out, Democrats are also unpopular in a lot of uniformly white rural areas.
There are, I believe, a combination of factors that make DC very Democratic. As the other answers state, there is the fact that it is urban, that it is majority minority (i.e. most people in the city fall into a demographic group that is a minority within the whole country - although there are more whites than one might think), and lots of federal government employees who - largely because of hostility that Republicans often exhibit toward them (the employees) - tend to vote Democratic.
There is another reason I want to bring up: Representation of the District at the national level (i.e. in Congress). As you likely know, the Constitution gives DC no representation in Congress. In the last couple decades, Democrats have generally supported giving DC representation in Congress. In fact, since 1993, they have given some voting rights in the full House of Representatives (when operating as a "Committee in the Whole") to DC's Congressional Delegate. On the other hand, whenever Republicans are in control they strip the Delegate of her vote in the full House. It is generally believed that the Democrats would also grant two Senators to the District, but that would require a Constitutional Amendment, which isn't likely to pass anytime soon.
(Source for some of this: https://en.wikipedia.org/wiki/District_of_Columbia%27s_at-large_congressional_district)