Certainly, sexual harassment may often be sparked by desire or the wish for a romantic relationship. In many cases, people who are in positions of power see opportunities to take advantage of those under them, knowing that employees fear losing their jobs and want to make their supervisors happy.
However, experts do note that many cases are about control and status more than anything else. As one report put it, "most [experts], however, agree that sexual harassment is not about desire but domination."
It's a way for one person to assert their power over the other. When they get to treat that person any way that they want, they show them that they're inferior. They establish their own dominance in the workplace. They care more about this sort of social ranking than they do about relationships or any other type of desire.
In this sense, sexual harassment is very similar to harassment based on any other factor, like age or race. It is simply a way that one person tries to dominate others based on traits that they cannot control. It is a way for them to make sure they have more power and that others know it.
This is why sexual harassment focuses not just on acts of an explicit nature, but also on gender-based harassment. It can be used to belittle someone and create a hostile workplace, even when no physical contact is ever made.
It's important to understand why harassment happens. Even more so, though, it is crucial for those who get harassed to know all the legal options they have to put an end to it.